Set Ruby interpreter via docker-compose.yml

Answered

When I tried to add Ruby interpreter based on docker-compose.yml, it failed.

Could you please tell me how I can add it correctly?

My docker-compose.yml is this:

version: "3.8"

services:
  main:
    image: ruby:2.5.3
    tty: true
    volumes:
      - ./:/myapp
    ports:
      - "3000:3000"
  db:
    image: postgres:10.6

After starting the container, I tried to update project SDK as follows:

1. Click Add SDK > Ruby SDK

2. Clicked “Remote interpreter or Version Manager”

3. I set “Service: main” and clicked OK

4. SDK was updated, but when I clicked “OK” button,

5.  it said “Gems bin directory does not exist”

6. The interpreter path was 
“docker-compose://[/Users/otsukakenji/project/proj_dir/docker-compose.yml]:main//usr/local/bin/ruby"
and Gems bin directory was
“/Users/otsukakenji/Library/Caches/JetBrains/IntelliJIdea2023.2/ruby_stubs/-616525414/usr/local/bundle/bin”

7. so I changed Gems bin directory to
“docker-compose://[/Users/otsukakenji/project/proj_dir/docker-compose.yml]:main//usr/local/bin"
like Ruby interpreter path,
but the same message appeared.

How can I set SDK via docker-compose.yml?
I tried the same procedure after executing docker-compose down but nothing changed.

Environment:

% docker-compose --version
Docker Compose version v2.7.0
% docker --version
Docker version 20.10.17, build 100c701
% uname -v
Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000
0
2 comments

Hello,

Would it be possible to share also Dockerfile, Gemfile and Gemfile.lock so that we can try to reproduce the problem? In addition, which IDEA version do you use?

0

Olga Kuvardina 

I just used docker-compose.yml without Dockerfile.

Well, I decided to use local Ruby, so no need to use docker interpreter.

Thanks.

When I get the same error in the future, I'll ask again.

0

Please sign in to leave a comment.