dev-environments icon indicating copy to clipboard operation
dev-environments copied to clipboard

Opening a service container in vscode stops the container's original running service

Open far-blue opened this issue 4 years ago • 2 comments

Describe the bug When creating a dev environment from a repo that has a .docker/docker-compose.yaml definition and then selecting one of the running services to access and work on within VSCode, the service is restarted with the command /sbin/docker-init -- sleep infinity`. Doing this replaces the original running functionality of the container. When wanting to edit source code and then access it via, say, a running apache or php-fpm service everything basically breaks.

To Reproduce Steps to reproduce the behavior:

  1. clone a repo with a .docker/docker-compose.yaml file containing 1 or more services that have running services (e.g. apache or php-fpm).
  2. select to access one of the services with vscode

Expected behavior I'd expect to have access to the container with the original service still running. I can understand if the container needs re-starting to mount the additional volumes but when doing so the original start command should be preserved.

** Possible workaround ** If the ability to mount the source code into service containers suggested in feature #51 was available then a special extra service could be defined within the docker-compose.yaml file specifically for source code editing. Alternatively, Docker Dev Environments could offer the option to create an additional service container for you. But both of these require feature #51

Desktop (please complete the following information):

  • OS: MacOS
  • Version 11.4

Version of Docker Desktop:
You can find the version by clicking on the About Docker Desktop menu

3.6.0

far-blue avatar Aug 23 '21 11:08 far-blue

can confirm this issue. it happens with custom built containers as well as with external images. for example:

  db:
    image: mariadb
    restart: always
    secrets:
      - db-password
    volumes:
      - db-data:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=vecoss
      - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
    ports:
      - 3306:3306

wont have mariadb service started when opened in vscode (but its working when just deployed and not opened in vscode)

timosystems avatar Mar 27 '22 07:03 timosystems

This is a problem for us. I am researching Dev Environments on behalf of several large teams so until it's fixed or a good workaround is suggested, I can't progress. Any update on it please Docker?

aglsteve avatar May 06 '22 10:05 aglsteve