vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

devcontainer fail to start when using docker-compose

Open loynoir opened this issue 2 years ago • 1 comments

  • VSCode Version: 1.59.1 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa x64
  • Local OS Version: ArchLinux
  • Local chip architecture: <x86, arm64, Apple Silicon>
  • Reproduces in: <Codespaces | Remote - Containers | Both>
  • Name of Dev Container Definition with Issue:

Steps to Reproduce:

  1. vscode > devcontainer add config > show all > from compose
  2. Reopen in container
  3. Log
Start: Run: docker inspect --type image reproduce_devcontainer_app
Command failed: docker inspect --type image reproduce_devcontainer_app
  1. Debug
$ docker image ls|grep reproduce
reproduce_devcontainer-app                                              latest         xxx   About a minute ago   570MB

Expected

Start: Run: docker inspect --type image reproduce_devcontainer-app

Actual

Start: Run: docker inspect --type image reproduce_devcontainer_app

loynoir avatar Aug 24 '22 05:08 loynoir

Thanks for reporting! This looks like a duplicate of https://github.com/microsoft/vscode-dev-containers/issues/1567 / https://github.com/microsoft/vscode-remote-release/issues/7047

Which version of Remote - Containers are you using? It should be fixed in the latest versions: https://github.com/microsoft/vscode-remote-release/issues/7047#issuecomment-1212197426.

jkeech avatar Aug 24 '22 15:08 jkeech

Just as an additional point, since google searching led me here.

If you:

  • call the command Dev Containers: Add Dev Container Configuration Files...
  • then chose From 'docker-compose.yml'
  • then in Select a service you select a service from your docker-compose.yml file that has a profiles entry like
version: "3"
services:
  myservice:
    profiles:
      - development
    build:
      context: "."

Then when you call Dev Containers: Reopen in Container, you'll hit an error like:

[2022-12-09T13:04:06.542Z] Start: Run: docker inspect --type image my-project-myservice
[2022-12-09T13:04:06.561Z] Stop (19 ms): Run: docker inspect --type image myproject-myservice
[2022-12-09T13:04:07.487Z] Error fetching image details: No manifest found for docker.io/library/myproject-myservice.
[2022-12-09T13:04:07.487Z] Start: Run: docker pull myproject-myservice
[2022-12-09T13:04:07.615Z] Using default tag: latest
[2022-12-09T13:04:09.459Z] Error response from daemon: pull access denied for myproject-myservice, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
[2022-12-09T13:04:09.461Z] Stop (1974 ms): Run: docker pull myproject-myservice
[2022-12-09T13:04:09.461Z] []
[2022-12-09T13:04:09.461Z] Error: No such image: myproject-myservice

[2022-12-09T13:04:09.463Z] Error: Command failed: docker inspect --type image myproject-myservice

This is caused by the profiles clause in the yaml. VS.Code selected a service that docker-compose will not try to build unless --profile <profile name> is added as an option to docker-compose, like:

  • docker-compose --profile developmet build -f docker-compose.yml ...

But dev-containters doesn't pass that option, despite allowing you to select a service that can only be built or brought up by specifying a profile.

There is an issue requesting profile support for docker-compose at microsoft/vscode-remote-release#5795

leorochael avatar Dec 09 '22 13:12 leorochael