0

I'm getting this error when trying to start the dev container.

[2025-03-19T16:39:10.740Z] Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "bundle": executable file not found in $PATH: unknown

If I hop into the container and check for executables, I don't see any related to ruby or bundler.

root ➜ / $ bundle
bash: bundle: command not found
root ➜ / $ gem
bash: gem: command not found
root ➜ / $ ruby
bash: ruby: command not found

I started going down the path of installing an official ruby image but I shouldn't need to with devcontainers. This is for an existing project but the complexity of services is quite minimal.

Here are my configs. I hope it's something obvious.

Dockerfile

ARG RUBY_VERSION=3.4.2
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION

# Install packages needed to build gems
RUN apt-get update -qq \
    && apt-get install --no-install-recommends -y \
    build-essential \
    libpq-dev \
    libvips \
    curl \
    imagemagick \
    postgresql-client \
    nodejs \
    vim \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

compose.yml

name: "escrow_safe"
services:
  web:
    build:
      dockerfile: .devcontainer/Dockerfile
      context: ..
    ports:
      - "3000:3000"
      - "12345:12345"
    command: sleep infinity
    environment:
      - ES_DEV_PHONE_OVERRIDE
      - DEV_EMAIL_PREFIX=${USER}
      - DATABASE_URL=postgres://root:password@postgres-db/
      - EDITOR=vim
      - ES_DEBUG_ENABLED=true
    volumes:
      - ../..:/workspaces:cached
    depends_on:
      postgres-db:
        condition: service_healthy

  solidq:
    build:
      dockerfile: .devcontainer/Dockerfile
      context: ..
    command: bundle exec rails solid_queue:start
    environment:
      - DATABASE_URL=postgres-db://root:password@postgres-db/
    volumes:
      - ../..:/workspaces:cached
      # - bundler_gems:/usr/local/bundle
    depends_on:
      postgres-db:
        condition: service_healthy

  postgres-db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: password
    volumes:
      - db_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    healthcheck:
      test: pg_isready
      interval: 2s
      timeout: 5s
      retries: 30

volumes:
  db_data:

devcontainer.json

{
  "name": "escrow_safe",
  "dockerComposeFile": "compose.yaml",
  "service": "web",
  // "workspaceFolder": "/rails",
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
  // Features to add to the dev container. More info: https://containers.dev/features.
  "features": {
    "ghcr.io/devcontainers/features/github-cli:1": {},
    "ghcr.io/rails/devcontainer/features/activestorage": {},
    "ghcr.io/rails/devcontainer/features/postgres-client": {},
    "ghcr.io/rails/devcontainer/features/bundler-cache:1": {}
  },
  "containerEnv": {
    "CAPYBARA_SERVER_PORT": "45678",
    "SELENIUM_HOST": "selenium",
    "DB_HOST": "postgres"
  },
  // Use 'forwardPorts' to make a list of ports inside the container available locally.
  "forwardPorts": [
    3000,
    5432,
    6379
  ],
  // Configure tool-specific properties.
  // "customizations": {},
  // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
  // "remoteUser": "root",
  // Use 'postCreateCommand' to run commands after the container is created.
  "postCreateCommand": "bin/setup"
}

1 Answer 1

1

Likely need something like (replace with valid path to the executables in this image)

ENV GEM_PATH="" \
    GEM_HOME="" \
    RUBY_HOME="" \
    PATH="/:${PATH}
Sign up to request clarification or add additional context in comments.

1 Comment

Hey, thanks. It turns out that the issue was something related to the solidq config, not the web config. I ended up removing the solidq service and just running solidq from within the web container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.