Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

vscode devcontainers - two images getting built every time #1733

Open
dss010101 opened this issue Apr 3, 2023 · 0 comments
Open

vscode devcontainers - two images getting built every time #1733

dss010101 opened this issue Apr 3, 2023 · 0 comments

Comments

@dss010101
Copy link

im using a remote container as my dev environment. so essentially in my project i have a Dockerfile, docker-compose.yml and my devcontainer.json that vscode uses to build, start and launch into the container with my code mounted. works great so far.
The thing is, on the linux host, if do a docker ps, i see my single container, but if look at the docker images, two are created, and the last one is the one started.

my docker-compose looks like this:

app:
    container_name: my_app 
    build:
      context: ..
      dockerfile: .devcontainer/Dockerfile
    volumes:
      - ../..:/workspaces:cached

and my .devcontainer.json looks like this:

 "name": "my_app_service",
    "dockerComposeFile": "docker-compose.yml",
    "service": "app",
    "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
    "customizations": { 
        "vscode": {
            "extensions": ["ms-python.python"]
        },
        "settings": {
            "terminal.integrated.shell.*": "/bin/bash"
        }
    }     

docker ps shows a single container running with:

container name: my_app
image: vsc-my_proj-64ad9a6809f39eaa523af6a319f22b90b2d1358fe3a8aebc93ac1dfaebf5f22a-uid

docker images shows two images created, with names:

REPOSITORY: my_app_devcontainer-app 
REPOSITORY: vsc-my_proj-64ad9a6809f39eaa523af6a319f22b90b2d1358fe3a8aebc93ac1dfaebf5f22a-uid

(note in the above 'my_proj' part of the image name comes from my the vscode project folder name i believe.) i can delete the first image given that it's not actually started. but i want to understand why this is happening? it happens every time, if rebuild or rebuild with no cache.

(On a side note - is there a way to specify an image name and tag using the .devcontainer.json?)

My setup is:

  1. running on Windows 11
  2. remoting into linux host via ssh, where code is in my home
  3. when project is opened, vscode builds, starts and launches into the container environment, mounting my source.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant