Good morning my friends
About using docker-compose on Container GitHub Codespaces
Due to the multi-language support I use "GitHub Codespaces" for container development and would like to add mongodb using docker-compose
I tried as follows,
Using the following example as a basis
In the ".devcontainer" directory
Added "docker-compose.yml" file with the following content
version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
I edited the ".devcontainer/devcontainer.json" file
And I removed the excerpt
"build": {
"dockerfile": "Dockerfile"
},
and added
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
When building the container for development the following error is returned
ea8).
[119 ms] Start: Resolving Remote
[128 ms] Setting up container for folder or workspace: /home/marcio/dados/acid-workflow-02
[131 ms] Start: Check Docker is running
[131 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[186 ms] Server API version: 1.41
[198 ms] Start: Run: docker-compose version --short
[705 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=acid-workflow-02_devcontainer --filter label=com.docker.compose.service=app
[749 ms] Start: Run: docker-compose -f /home/marcio/dados/acid-workflow-02/.devcontainer/docker-compose.yml config
[1243 ms] services:
app:
build:
context: /home/marcio/dados/acid-workflow-02/.devcontainer
dockerfile: Dockerfile
version: '3.0'
[1243 ms]
[1244 ms] Start: Run: docker -v
[1283 ms] Start: Run: docker events --format {{json .}} --filter event=start
[1288 ms] Start: Run: docker-compose --project-name acid-workflow-02_devcontainer -f /home/marcio/dados/acid-workflow-02/.devcontainer/docker-compose.yml build
Building app
Step 1/29 : FROM mcr.microsoft.com/vscode/devcontainers/universal:1-focal
---> 6f68ac61f636
Step 2/29 : USER root
---> Using cache
---> 416135f1e190
Step 3/29 : RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y install --no-install-recommends jq
---> Using cache
---> fb937be159ec
Step 4/29 : RUN curl https://cli-assets.heroku.com/install.sh | sh
---> Using cache
---> 4c3b8f453f15
Step 5/29 : USER codespace
---> Using cache
---> 6de253fb7551
Step 6/29 : RUN npm install -g netlify-cli
---> Using cache
---> 6fb737d3ffa9
Step 7/29 : RUN npm install -g vercel
---> Using cache
---> Using cache
---> fcaf92d1d59b
Step 28/29 : RUN git config --global user.name "gmail"
---> Using cache
---> a5a33ea9a51e
Step 29/29 : RUN git config --global user.email "[email protected]"
---> Using cache
---> bad17207e1d1
Successfully built bad17207e1d1
Successfully tagged acid-workflow-02_devcontainer_app:latest
[1996 ms] Start: Run: docker inspect --type image acid-workflow-02_devcontainer_app
[2051 ms] Start: Run: docker build -f /tmp/vsch/updateUID.Dockerfile-0.191.0 -t vsc-acid-workflow-02-60ab5310082db6cd686579e8f1b62f88-uid --build-arg BASE_IMAGE=acid-workflow-02_devcontainer_app --build-arg REMOTE_USER=codespace --build-arg NEW_UID=1000 --build-arg NEW_GID=1000 --build-arg IMAGE_USER=codespace /tmp/vsch
Sending build context to Docker daemon 61.03MB
Step 1/10 : ARG BASE_IMAGE
Step 2/10 : FROM $BASE_IMAGE
---> bad17207e1d1
Step 3/10 : USER root
---> Using cache
---> b1345a3b3a81
Step 4/10 : ARG REMOTE_USER
---> Using cache
---> a8ca68a8a1e3
Step 5/10 : ARG NEW_UID
---> Using cache
---> 760086d28c88
Step 6/10 : ARG NEW_GID
---> Using cache
---> 2155a053cc53
Step 7/10 : SHELL ["/bin/sh", "-c"]
---> Using cache
---> 23633c57bbc3
Step 8/10 : RUN eval $(sed -n "s/${REMOTE_USER}:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^:]*\).*/OLD_UID=\1;OLD_GID=\2;HOME_FOLDER=\3/p" /etc/passwd); eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_UID}:.*/EXISTING_USER=\1/p" /etc/passwd); eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_GID}:.*/EXISTING_GROUP=\1/p" /etc/group); if [ -z "$OLD_UID" ]; then echo "Remote user not found in /etc/passwd ($REMOTE_USER)."; elif [ "$OLD_UID" = "$NEW_UID" -a "$OLD_GID" = "$NEW_GID" ]; then echo "UIDs and GIDs are the same ($NEW_UID:$NEW_GID)."; elif [ "$OLD_UID" != "$NEW_UID" -a -n "$EXISTING_USER" ]; then echo "User with UID exists ($EXISTING_USER=$NEW_UID)."; elif [ "$OLD_GID" != "$NEW_GID" -a -n "$EXISTING_GROUP" ]; then echo "Group with GID exists ($EXISTING_GROUP=$NEW_GID)."; else echo "Updating UID:GID from $OLD_UID:$OLD_GID to $NEW_UID:$NEW_GID."; sed -i -e "s/\(${REMOTE_USER}:[^:]*:\)[^:]*:[^:]*/\1${NEW_UID}:${NEW_GID}/" /etc/passwd; if [ "$OLD_GID" != "$NEW_GID" ]; then sed -i -e "s/\([^:]*:[^:]*:\)${OLD_GID}:/\1${NEW_GID}:/" /etc/group; fi; chown -R $NEW_UID:$NEW_GID $HOME_FOLDER; fi;
---> Using cache
---> 13f0fd916a8d
Step 9/10 : ARG IMAGE_USER
---> Using cache
---> 16efb921b17e
Step 10/10 : USER $IMAGE_USER
---> Using cache
---> a4f84f89a8f3
Successfully built a4f84f89a8f3
Successfully tagged vsc-acid-workflow-02-60ab5310082db6cd686579e8f1b62f88-uid:latest
[2583 ms] Start: Run: docker-compose --project-name acid-workflow-02_devcontainer -f /home/marcio/dados/acid-workflow-02/.devcontainer/docker-compose.yml -f /tmp/docker-compose.devcontainer.containerFeatures-1629128082328.yml up -d
Creating network "acid-workflow-02_devcontainer_default" with the default driver
Creating acid-workflow-02_devcontainer_app_1 ... done
[3947 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=acid-workflow-02_devcontainer --filter label=com.docker.compose.service=app
[4001 ms] Start: Run: docker inspect --type container 590ec81579fc
[4214 ms] Start: Inspecting container
[4214 ms] Start: Run: docker inspect --type container 590ec81579fc8789b6cdc99cbeabc2cfd6578c61ad56f00ca74b341bec48c75f
[4281 ms] Start: Run in container: /bin/sh
[4298 ms] Start: Run in container: uname -m
[4425 ms] Start: Run in container: cat /etc/passwd
[4425 ms] Stdin closed!
[4429 ms] Shell server terminated (code: 1, signal: null)
Error response from daemon: Container 590ec81579fc8789b6cdc99cbeabc2cfd6578c61ad56f00ca74b341bec48c75f is not running
Thank you in advance if you can help