Code Monkey home page Code Monkey logo

devcont-compose-project's Introduction

Remote containers don't respect COMPOSE_PROJECT_NAME

Start the containers:

$ cd src
$ docker compose up

# in another terminal
$ docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS          PORTS                  NAMES
5fecc27a3bbf   nginx:1.18-alpine   "/docker-entrypoint.…"   25 minutes ago   Up 25 minutes   0.0.0.0:9000->80/tcp   devcont-example-nginx-1
36c6e5d347ed   python:3.8          "sleep 365d"             25 minutes ago   Up 25 minutes                          devcont-example-backend-1

# compose is using project name "devcont-example" from .env file

Open folder src/vscode and click Reopen in Container, it'll fail to start because it'll try to start the compose again with project name src. VSCode logs:

[1097 ms] Start: Run: docker -v
[1160 ms] Start: Run: docker events --format {{json .}} --filter event=start
[1165 ms] Start: Run: docker-compose --project-name src -f /home/david/work/devcont-compose-project/src/docker-compose.yaml build
[1389 ms] PersistedPath=/tmp, ContainerHasLabels=false
[1389 ms] Generating composeOverrideFile...
[1398 ms] Start: Run: docker inspect --type image python:3.8

And now:

$ docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED              STATUS              PORTS                  NAMES
00a49aa74c6b   python:3.8          "/bin/sh -c 'echo Co…"   About a minute ago   Up About a minute                          src-backend-1
5fecc27a3bbf   nginx:1.18-alpine   "/docker-entrypoint.…"   28 minutes ago       Up 28 minutes       0.0.0.0:9000->80/tcp   devcont-example-nginx-1
36c6e5d347ed   python:3.8          "sleep 365d"             28 minutes ago       Up 28 minutes                              devcont-example-backend-1

# vs code incorrectly tried to start again with project name "src", but failed to
# start the nginx container because another one already has a bind on port 9000

devcont-compose-project's People

Contributors

davidrios avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.