Remote Dev Containers - Moving to Docker Compose - docker

I'm using VSCode Devcontainers to develop a micro-services application and I've been using a Java Devcontainer without issues.
But, given the micro-service nature of the project, there are other containers I need to execute (for instance, a postgres db).
This is the only container I use to develop, where I install Java-specific extensions, intellisense working, etc. I do NOT have this on my local machine nor do I want to have. Only when coding on the container.
Now, I did some research to shift the use of Devcontainers to docker-compose and start not only the Java devcontainer but also the database.
Everything seems to run fine.
However, the dev container will alway exit with code 137 and I can't figure out why.
The structure of the code is as follows:
|.devcontainer
|--devcontainer.json
|--Dockerfile
|--docker-compose.yaml
|.git
|actionable-content
|--(my module code)
|db
|--Dockerfile
|--init.sql
|(...)
This is the output of the containers build commands:
[18 ms] Start: Resolving remote
[20 ms] Setting up container for folder or workspace: /Users/zed/Projects/circle-labs
[39 ms] Start: Check Docker is running
[39 ms] Start: Run: docker info
[401 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=evooq-circle --filter label=com.docker.compose.service=dev-container
[444 ms] Start: Run: docker inspect --type container ea365c78bc6d
[490 ms] Start: Removing existing container.
[490 ms] Start: Run: docker rm -f ea365c78bc6d229737805fe4121324b45c87688ccd369bccebf209689f2658d7
[611 ms] Start: Run: docker-compose -f /Users/zed/Projects/circle-labs/.devcontainer/docker-compose.yaml config --services
[1027 ms] Start: Run: docker events --format {{json .}} --filter status=start
[1032 ms] Start: Run: docker-compose --project-name evooq-circle -f /Users/zed/Projects/circle-labs/.devcontainer/docker-compose.yaml up -d --build db dev-container
Building db
Step 1/2 : FROM postgres:9.6
---> 16f0ba6ed857
Step 2/2 : COPY init.sql /docker-entrypoint-initdb.d/
---> Using cache
---> e90f4e0c7c73
Successfully built e90f4e0c7c73
Successfully tagged evooq-circle_db:latest
Building dev-container
Step 1/15 : FROM openjdk:11-jdk
---> a548e8a50190
Step 2/15 : ARG USERNAME=vscode
---> Using cache
---> bd1352aa5e59
Step 3/15 : ARG USER_UID=1000
---> Using cache
---> 192dca586afc
Step 4/15 : ARG USER_GID=$USER_UID
---> Using cache
---> 91a3124b064c
Step 5/15 : ENV DEBIAN_FRONTEND=noninteractive
---> Using cache
---> 222b620a3e1b
Step 6/15 : RUN apt-get update && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 && groupadd --gid $USER_GID $USERNAME && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME && apt-get install -y sudo && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && chmod 0440 /etc/sudoers.d/$USERNAME && apt-get -y install git openssh-client less iproute2 procps curl lsb-release
---> Using cache
---> 8ad502a168f4
Step 7/15 : ARG MAVEN_VERSION=3.6.3
---> Using cache
---> 2f0fed0ae029
Step 8/15 : ARG MAVEN_SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
---> Using cache
---> ba172229c081
Step 9/15 : RUN mkdir -p /usr/share/maven /usr/share/maven/ref && curl -fsSL -o /tmp/apache-maven.tar.gz https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz && echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 && rm -f /tmp/apache-maven.tar.gz && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
---> Using cache
---> 033989c61d1f
Step 10/15 : COPY maven-settings.xml /usr/share/maven/ref/
---> Using cache
---> 5dcb163d3198
Step 11/15 : ENV MAVEN_HOME /usr/share/maven
---> Using cache
---> 9c21dcb2fa42
Step 12/15 : ENV MAVEN_CONFIG /root/.m2
---> Using cache
---> 56960418c145
Step 13/15 : RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 939839f8b869
Step 14/15 : ENV DEBIAN_FRONTEND=dialog
---> Using cache
---> da8ceada8e6f
Step 15/15 : RUN if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi
---> Using cache
---> 8781e2f051b0
Successfully built 8781e2f051b0
Successfully tagged evooq-circle_dev-container:latest
evooq-circle_db_1 is up-to-date
Creating evooq-circle_dev-container_1 ... done
[2449 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=evooq-circle --filter label=com.docker.compose.service=dev-container
[2507 ms] Start: Run: docker inspect --type container f11a0e8f78c2
[2555 ms] Start: Inspecting container
[2555 ms] Start: Run: docker inspect --type container f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49
[2609 ms] Start: Run: docker exec -i -u root -e VSCODE_REMOTE_CONTAINERS_SESSION=190e175e-f482-4554-aaf4-e062c672fcdb1593105541203 f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 /bin/sh
[2614 ms] Start: Run in container: uname -m
[2753 ms] x86_64
[2753 ms]
[2753 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[2761 ms] PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
[2761 ms]
[2761 ms] Start: Run in container: cat /etc/passwd
[2765 ms] Start: Updating configuration state
[2770 ms] Start: Setup shutdown monitor
[2773 ms] Forking shutdown monitor: /Users/zed/.vscode/extensions/ms-vscode-remote.remote-containers-0.122.1/dist/shutdownMonitorProcess /var/folders/bp/bjk1_4fs2ljdx8pflq89nd500000gn/T/vscode-remote-containers-e8ace0f38179417fa6822e6d83141fd504155ae0.sock dockerCompose Info /Users/zed/Library/Application Support/Code/logs/20200625T091545/exthost3/ms-vscode-remote.remote-containers
[2779 ms] Start: Run in container: test -d /root/.vscode-server
[2785 ms]
[2785 ms]
[2785 ms] Exit code 1
[2785 ms] Start: Run in container: test -d /root/.vscode-remote
[2788 ms]
[2788 ms]
[2788 ms] Exit code 1
[2788 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[2797 ms]
[2797 ms]
[2797 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && cat >'/root/.vscode-server/data/Machine/settings.json' <<'settingsJSON'
[2804 ms]
[2804 ms]
[2804 ms] Start: Run in container: test -d /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
[2806 ms]
[2806 ms]
[2806 ms] Exit code 1
[2807 ms] Installing VS Code Server for commit cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
[2807 ms] Start: Run in container: mkdir -p /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d_1593105545145
[2811 ms]
[2811 ms]
[2812 ms] Start: Run: docker exec -i -u root -w /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d_1593105545145 f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 tar --no-same-owner -xz --strip-components 1
[5305 ms]
[5306 ms]
[5306 ms] Start: Run in container: mv -n /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d_1593105545145 /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
[5317 ms]
[5317 ms]
[5317 ms] Start: Launching Remote-Containers helper.
[5318 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[5343 ms] Start: Run in container: gpgconf --list-dir agent-socket
[5348 ms] /root/.gnupg/S.gpg-agent
[5348 ms]
[5348 ms] Start: Run in container: mkdir -p -m 700 '/root/.gnupg'
[5356 ms]
[5356 ms]
[5356 ms] Start: Run in container: # Copy /Users/zed/.gitconfig to /root/.gitconfig
[5356 ms] Start: Run: gpgconf --list-dir homedir
[5369 ms]
[5369 ms]
[5369 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-f97cc7a21081e70e2303f2544443a16dbafee09f.js' >/tmp/vscode-remote-containers-f97cc7a21081e70e2303f2544443a16dbafee09f.js
[5382 ms]
[5382 ms]
[5382 ms] Start: Run in container: gpgconf --list-dir homedir
[5401 ms] /root/.gnupg
[5401 ms]
[5401 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global credential.helper '!f() { /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node /tmp/vscode-remote-containers-f97cc7a21081e70e2303f2544443a16dbafee09f.js $*; }; f' || true
[5419 ms]
[5419 ms]
[5420 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-f97cc7a21081e70e2303f2544443a16dbafee09f.js' >/tmp/vscode-remote-containers-server-f97cc7a21081e70e2303f2544443a16dbafee09f.js
[5442 ms]
[5442 ms]
[5443 ms] Start: Run in container: # Copy /Users/zed/.gnupg/pubring.kbx to /root/.gnupg/pubring.kbx
[5445 ms] Start: Run: docker exec -i -u root -e REMOTE_CONTAINERS_SOCKETS=["/tmp/vscode-ssh-auth-f97cc7a21081e70e2303f2544443a16dbafee09f.sock","/root/.gnupg/S.gpg-agent"] -e REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-f97cc7a21081e70e2303f2544443a16dbafee09f.sock f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node /tmp/vscode-remote-containers-server-f97cc7a21081e70e2303f2544443a16dbafee09f.js
[5482 ms]
[5482 ms]
[5482 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[5494 ms]
[5494 ms]
[5494 ms] Start: Run in container: # Copy /Users/zed/.gnupg/trustdb.gpg to /root/.gnupg/trustdb.gpg
[5529 ms]
[5529 ms]
[5529 ms] Start: Run in container: test -d /root/.vscode-server/extensionsCache && ls /root/.vscode-server/extensionsCache || true
[5530 ms] Start: Run: gpg-connect-agent updatestartuptty /bye
[5536 ms]
[5536 ms]
[5539 ms] Start: Run in container: mkdir -p /root/.vscode-server/extensionsCache/tmp-1593105547877
[5553 ms]
[5553 ms]
[5553 ms] Start: Run: docker exec -i -u root -w /root/.vscode-server/extensionsCache/tmp-1593105547877 f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 tar x --strip-components 1
[6353 ms] Start: Run in container: mv /root/.vscode-server/extensionsCache/tmp-1593105547877/* /root/.vscode-server/extensionsCache && rmdir /root/.vscode-server/extensionsCache/tmp-1593105547877
[6393 ms]
[6394 ms]
[6394 ms] Start: Run in container: cd /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d; export VSCODE_AGENT_FOLDER=/root/.vscode-server; /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/server.sh --extensions-download-dir /root/.vscode-server/extensionsCache --install-extension vscjava.vscode-java-pack --install-extension pivotal.vscode-boot-dev-pack --install-extension github.vscode-pull-request-github --install-extension kumar-harsh.graphql-for-vscode --install-extension zxh404.vscode-proto3 --install-extension humao.rest-client --force
[6704 ms] Start: Run in container: ls /root/.vscode-server/extensionsCache
[6704 ms] Stdin closed!
[6706 ms] Shell server terminated (code: 137, signal: null)
[6747 ms] Remote-Containers server terminated (code: 137, signal: null).
I suspect the issue may lie in the extensions installation process, but I'm not entirely sure.
Anyway, I went from this combination of devcontainer.json + Dockerfile here (gist), to the combination of devcontainer.json + docker-compose.yaml + Dockerfile, that are here (another gist).
What could be causing the errors above? I'm really lost here as I don't see a reason.
Also, I suspect I need the runArgs from the initial version but they seem not to be supported when using docker-compose mode.
Thanks

Well, for any of you that end up here looking here, here's what I changed that did the trick:
On my docker-compose.yaml I added the following:
volumes:
# Make the first part whatever your working dir is
- ..:/workspace:cached
- "${HOME}/.ssh:/root/.ssh-localhost:ro"
command: /bin/sh -c "while sleep 1000; do :; done"
On the Dockerfile I added a CMD to the end as well:
CMD [ "sleep", "infinity" ]
Then, rebuild the image, and it should work.
Also, regarding the runArgs, I added this to my docker-compose.yaml file:
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
These additions/modifications should do the trick for you as well

This is the command I always use in any Dockerfile for VSCode:
# Keep container running (for use in VSCode)
CMD [ "tail", "-f", "/dev/null" ]

Related

Override UID GID in VSCode Remote-containers session

I am running VSCode in a Windows 10 machine, connecting to a Docker instance on a remote Linux host, to develop C++ projects. The docker instance mounts local folders for source code files, and user is set to match the user on Linux host to avoid file ownership and permission problems.
On Windows 10 I use WSL1, the default user has both UID/GID 1000, and the VSCode's docker processes use these IDs to launch and connect to the docker instance on remote. Is there a way to override the UID/GID VSCode uses so they match the IDs on remote?
Thanks,
Step 1/4 : FROM devenv:latest
---> 120d987bae07
Step 2/4 : RUN groupadd -g 301765 chengd
---> Using cache
---> 58a697ed3565
Step 3/4 : RUN useradd -l -u 301765 -g chengd chengd
---> Using cache
---> b5c7c2b48a83
Step 4/4 : USER chengd
---> Using cache
---> f310c9d1e05b
Successfully built f310c9d1e05b
Successfully tagged vsc-devenv-9da1a5f5cedc16a80d314a148acdbcaf:latest
[7325 ms] Start: Run: wsl -d Ubuntu-20.04 -e /bin/sh -c cd '/home/da/repos/devenv' && DISPLAY='1' ELECTRON_RUN_AS_NODE='1' SSH_ASKPASS='d:\Users\ChengD\.vscode\extensions\ms-vscode-remote.remote-containers-0.177.2\scripts\ssh-askpass.bat' VSCODE_SSH_ASKPASS_NODE='D:\Users\ChengD\AppData\Local\Programs\Microsoft VS Code\Code.exe' VSCODE_SSH_ASKPASS_MAIN='d:\Users\ChengD\.vscode\extensions\ms-vscode-remote.remote-containers-0.177.2\dist\common\sshAskpass.js' VSCODE_SSH_ASKPASS_HANDLE='\\.\pipe\ssh-askpass-7e8e4f69496930d0e88509584ba46ab3357d9ff1-sock' DOCKER_CONTEXT='tcp_201' VSCODE_SSH_ASKPASS_COUNTER='5' docker 'inspect' '--type' 'image' 'vsc-devenv-9da1a5f5cedc16a80d314a148acdbcaf'
[10240 ms] Start: Run: wsl -d Ubuntu-20.04 -e /bin/sh -c cd '/home/da/repos/devenv' && DISPLAY='1' ELECTRON_RUN_AS_NODE='1' SSH_ASKPASS='d:\Users\ChengD\.vscode\extensions\ms-vscode-remote.remote-containers-0.177.2\scripts\ssh-askpass.bat' VSCODE_SSH_ASKPASS_NODE='D:\Users\ChengD\AppData\Local\Programs\Microsoft VS Code\Code.exe' VSCODE_SSH_ASKPASS_MAIN='d:\Users\ChengD\.vscode\extensions\ms-vscode-remote.remote-containers-0.177.2\dist\common\sshAskpass.js' VSCODE_SSH_ASKPASS_HANDLE='\\.\pipe\ssh-askpass-7e8e4f69496930d0e88509584ba46ab3357d9ff1-sock' DOCKER_CONTEXT='tcp_201' VSCODE_SSH_ASKPASS_COUNTER='6' docker 'build' '-f' '/tmp/vsch/updateUID.Dockerfile-0.177.2' '-t' 'vsc-devenv-9da1a5f5cedc16a80d314a148acdbcaf-uid' '--build-arg' 'BASE_IMAGE=vsc-devenv-9da1a5f5cedc16a80d314a148acdbcaf' '--build-arg' 'REMOTE_USER=chengd' '--build-arg' 'NEW_UID=1000' '--build-arg' 'NEW_GID=1000' '--build-arg' 'IMAGE_USER=chengd' '/tmp/vsch'
Solved the problem by setting updateRemoteUserUID to false in devcontainer.json.

Container not running

could you help me?
I'm trying to run a container by a dockerfile but it shows this
warning and my container does not start.
compose.parallel.parallel_execute_iter: Finished processing:
<Container: remote-Starting remote-host ... done
compose.parallel.feed_queue: Pending: set()
compose.parallel.parallel_execute_iter: Finished processing: <Service:
remote_host>
compose.parallel.feed_queue: Pending: set()
Attaching to jenkinks, remote-host
compose.cli.verbose_proxy.proxy_callable: docker logs <-
('f2e305942e57ce1fe90c2ca94d3d9bbc004155a136594157e41b7a916d1ca7de',
stdout=True, stderr=True, stream=True, follow=True)
remote-host | Unable to load host key: /etc/ssh/ssh_host_rsa_key
remote-host | Unable to load host key: /etc/ssh/ssh_host_ecdsa_key
remote-host | Unable to load host key:
/etc/ssh/ssh_host_ed25519_key remote-host | sshd: no hostkeys
available -- exiting.
compose.cli.verbose_proxy.proxy_callable: docker events <-
(filters={'label': ['com.docker.compose.project=jenkins',
'com.docker.compose.oneoff=False']}, decode=True)
My dockerfile is this:
FROM centos RUN yum -y install openssh-server RUN yum install -y
passwd RUN useradd remote_user &&
echo "1234" | passwd remote_user --stdin &&
mkdir /home/remote_user/.ssh &&
chmod 700 /home/remote_user/.ssh COPY remote_user.pub /home/remote_user/.ssh/authorized_keys RUN chown
remote_user:remote_user -R /home/remote_user &&
chmod 400 /home/remote_user/.ssh/authorized_keys CMD /usr/sbin/sshd -D
start with an empty dir and put following in that dir as a file called Dockerfile
FROM centos
RUN yum -y install openssh-server
RUN yum install -y passwd
RUN useradd remote_user
RUN echo "1234" | passwd remote_user --stdin
RUN mkdir /home/remote_user/.ssh
RUN chmod 700 /home/remote_user/.ssh
COPY remote_user.pub /home/remote_user/.ssh/authorized_keys
RUN chown remote_user:remote_user -R /home/remote_user
RUN chmod 400 /home/remote_user/.ssh/authorized_keys
CMD /usr/sbin/sshd -D
# CMD ["/bin/bash"]
# ... save this file as Dockerfile then in same dir issue following
#
# docker build --tag stens_centos . # creates image stens_ubuntu
#
# docker run -d stens_centos sleep infinity # launches container and just sleeps only purpose here is to keep container running
#
# docker ps # show running containers
#
#
# ... find CONTAINER ID from above and put into something like this
#
# docker exec -ti $( docker ps | grep stens_centos | cut -d' ' -f1 ) bash # login to running container
#
then in that same dir put your ssh key files as per
eve#milan ~/Dropbox/Documents/code/docker/centos $ ls -la
total 28
drwxrwxr-x 2 eve eve 4096 Nov 2 15:20 .
drwx------ 77 eve eve 12288 Nov 2 15:14 ..
-rw-rw-r-- 1 eve eve 875 Nov 2 15:20 Dockerfile
-rwx------ 1 eve eve 3243 Nov 2 15:18 remote_user
-rwx------ 1 eve eve 743 Nov 2 15:18 remote_user.pub
then cat out Dockerfile and copy and paste commands it explains at bottom of Dockerfile file ... for me all of them just worked OK
after I copy and pasted those commands listed at bottom of Dockerfile the container gets built and executed
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a06ebd2752a stens_centos "sleep infinity" 7 minutes ago Up 7 minutes pedantic_brahmagupta
keep in mind you must define in your Dockerfile the bottom CMD or similar to be just what you want to get executed as the container runs which typically is a server which by definition runs forever ... alternatively this CMD can be simply something which runs then finishes like a batch job in which case the container will exit when that job finishes ... with this knowledge I suggest you confirm sshd -D will hold that command as a server or will immediately terminate upon launch of container
I've just replied to this GitHub issue, but here's what I experienced and how I fixed it
I just had this issue for my Jekyll blog site which I normally bring up using docker-compose with mapped volume to rebuild when I create a new post - it was hanging, tried to run docker-compose up with the --verbose switch and saw the same compose.parallel.feed_queue: Pending: set().
I tried it on my Macbook and it was working fine
I didn't have any experimental features turned on, but I need need to go into (on Windows) settings-> resources -> File Sharing and add the folder I was mapping in my docker compose (the root of my blog site)
Re ran docker compose and its now up and running
Version Info:

Add at command to docker

Hello i want to add At command to docker container. I am using linux alpine .
I tried to use apk add at andapk add atd it is giving me the same error.
ERROR: unsatisfiable constraints: atd (missing):
required by: world[atd]
Is there a way to fix that or can is there a way to use apt-get since at exists for apt-get
Looks like at just available as is: apk add at
this Dockerfile works fine for me:
FROM alpine:latest
RUN apk add at
CMD at --help
example run:
$ docker build -t at_command_line -f Dockerfile .
$ docker run at_command_line:latest
at: unrecognized option: -
Usage: at [-V] [-q x] [-f file] [-u username] [-mMlbv] timespec ...
at [-V] [-q x] [-f file] [-u username] [-mMlbv] -t time
at -c job ...
atq [-V] [-q x]
at [ -rd ] job ...
atrm [-V] job ...
batch
I would just add to #ujlbu4's answer that you need to run the at daemon atd once your container is up and running or else the jobs will sit in the queue without getting executed.
Example Dockerfile:
FROM python:alpine
RUN apk add at
ENTRYPOINT ["atd"]
If you don't run atd you may see the following:
$ docker exec -it my_running_container /bin/sh
# echo "echo hi" | at now + 1 minutes
warning: commands will be executed using /bin/sh
job 6 at Mon Jun 21 18:11:00 2021
Can't open /var/run/atd.pid to signal atd. No atd running?

DDEV + NFS + Windows: nfs gives operation not supported

I have successfully installed the nfs service on Windows 10 Pro (NFS Client is activated). It was already working, but suddenly it is not working anymore.
I think NFS Server/Service is successfully configured and installed. mount \\127.0.0.1/c/Projects N: I can mount the Share locally.
ddev start (with nfs_mount_enabled: false) works ddev start (with nfs_mount_enabled: true) gives me the
error:
Starting yogamehome-2020... Pushing mkcert rootca certs to ddev-global-cache Pushed mkcert rootca certs to ddev-global-cache Building db Building web Recreating ddev-yogamehome-2020-db ... done Recreating ddev-yogamehome-2020-web ... error Recreating ddev-yogamehome-2020-dba ...
ERROR: for ddev-yogamehome-2020-web Cannot start service web: error while mounting volume '/var/lib/docker/volumes/ddev-yogamehome-2020_nfsmount/_data': failed to mount local volume: mount :/c/Projects/yogamehome-2020:/var/lib/docker/volumes/ddev-yogamehome-2020_n Recreating ddev-yogamehome-2020-dba ... doneock: operation not supported
ERROR: for web Cannot start service web: error while mounting volume '/var/lib/docker/volumes/ddev-yogamehome-2020_nfsmount/_data': failed to mount local volume: mount :/c/Projects/yogamehome-2020:/var/lib/docker/volumes/ddev-yogamehome-2020_nfsmount/_data, data: addr=127.0.0.1,hard,nolock: operation not supported Encountered errors while bringing up the project. Failed to start yogamehome-2020: Failed to run docker-compose [-f C:\Projects\yogamehome-2020.ddev\docker-compose.yaml -f C:\Projects\yogamehome-2020.ddev\docker-compose.environment.yaml -f C:\Projects\yogamehome-2020.ddev\docker-compose.hosts.yaml up --build -d ], err='exit status 1', stdout='Step 1/6 : ARG BASE_IMAGE Step 2/6 : FROM $BASE_IMAGE ---> 94b0ac137a40 Step 3/6 : ARG username ---> Using cache ---> 56f6d4f186b1 Step 4/6 : ARG uid ---> Using cache ---> 02f90fa967ed Step 5/6 : ARG gid ---> Using cache ---> 2f6228a1a2d0 Step 6/6 : RUN (groupadd --gid $gid "$username" || groupadd "$username" || true) && (useradd -l -m -s "/bin/bash" --gid "$username" --comment '' --uid $uid "$username" || useradd -l -m -s "/bin/bash" --gid "$username" --comment '' "$username") ---> Using cache ---> c3a74d13aecb
Successfully built c3a74d13aecb Successfully tagged drud/ddev-dbserver-mariadb-10.2:v1.13.0-yogamehome-2020-built Step 1/6 : ARG BASE_IMAGE Step 2/6 : FROM $BASE_IMAGE ---> 82d77d5c110a Step 3/6 : ARG username ---> Using cache ---> a4ae9b611d25 Step 4/6 : ARG uid ---> Using cache ---> 9a4a76b8819c Step 5/6 : ARG gid ---> Using cache ---> 6ef62cc84fc9 Step 6/6 : RUN (groupadd --gid $gid "$username" || groupadd "$username" || true) && (useradd -l -m -s "/bin/bash" --gid "$username" --comment '' --uid $uid "$username" || useradd -l -m -s "/bin/bash" --gid "$username" --comment '' "$username") ---> Using cache ---> 764de2909aba
Successfully built 764de2909aba Successfully tagged drud/ddev-webserver:v1.13.0-yogamehome-2020-built ', stderr='Building db Building web Recreating ddev-yogamehome-2020-db ... done Recreating ddev-yogamehome-2020-web ... error Recreating ddev-yogamehome-2020-dba ...
ERROR: for ddev-yogamehome-2020-web Cannot start service web: error while mounting volume '/var/lib/docker/volumes/ddev-yogamehome-2020_nfsmount/_data': failed to mount local volume: mount :/c/Projects/yogamehome-2020:/var/lib/docker/volumes/ddev-yogamehome-2020_n Recreating ddev-yogamehome-2020-dba ... doneock: operation not supported
ERROR: for web Cannot start service web: error while mounting volume '/var/lib/docker/volumes/ddev-yogamehome-2020_nfsmount/_data': failed to mount local volume: mount :/c/Projects/yogamehome-2020:/var/lib/docker/volumes/ddev-yogamehome-2020_nfsmount/_data, data: addr=127.0.0.1,hard,nolock: operation not supported Encountered errors while bringing up the project.'`
Any idea?
I can access it via Explorer and every directory is there, but cannot mount it via ddev.
Most recent version of ddev.
Thanks and kind regards, Harald
shareeditdeleteflag
You have not included C:\Projects in your ~/.ddev/nfs_exports.txt
The error says "failed to mount local volume: mount :/c/Projects/yogamehome-2020:"
It's generally recommended to have your projects in a home directory, but since you have them in \Projects, you'll need to share that in nfs_exports.txt. Add a line like this:
C:\Projects > /c/Projects
i have exactly that line in my nfs_exports.txt:
C:\Projects > /c/Projects
As i wrote above i can mount the directory locally. So i gues the Problem is not on the server side.
Thanks,
Harald
Update:
If i start ddev without nfs and then try to mount via ssh:
holzm#yogamehome-2020-web:~/nfs-mount$ sudo mount -t nfs 127.0.0.1:/Projects ~/nfs-mount
mount: /home/holzm/nfs-mount: permission denied.

VS Code Container Remote Extension: Could not fetch remote environment

I have a problem with VS Code remote development. I am using a docker container to isolate my environment. This works on my main machine, but not on my Laptop which I recently set up.
The Laptop stats:
Linux Thinkpad 5.4.7-arch1-1 #1 SMP PREEMPT Tue, 31 Dec 2019 17:20:16 +0000 x86_64 GNU/Linux
I have installed the most recent version of the VS Code binaries (not the open source version) and the extension for remote development.
Now when I try to open a preexisiting project (which works on my main machine) inside a container or try to attach to a running container I get two notifications in vs code and no access to the project files.
Container Build Log
[0 ms] Start: Resolving remote
[1 ms] Setting up container for folder or workspace: /home/philipp/Projects/Ferienwohnung_Walther
[4 ms] Start: Check Docker is running
[33 ms] Start: Run: docker build -f /home/philipp/Projects/Ferienwohnung_Walther/.devcontainer/Dockerfile -t vsc-ferienwohnung_walther-f2cd21b5a0eb18ef2a7ad25ba128b053 /home/philipp/Projects/Ferienwohnung_Walther/.devcontainer
[65 ms] Sending build context to Docker daemon 5.632kB
[102 ms] Step 1/6 : FROM node:lts
[102 ms] ---> 6b5991bf650f
Step 2/6 : ENV DEBIAN_FRONTEND=noninteractive
[102 ms] ---> Using cache
---> 60d927450ba8
Step 3/6 : ARG USER_UID=1000
[103 ms] ---> Using cache
---> 4d5dc4e9421a
Step 4/6 : ARG USER_GID=$USER_UID
[103 ms] ---> Using cache
---> 283c5b3feb04
Step 5/6 : RUN apt-get update && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 && apt-get -y install git iproute2 procps && npm install -g eslint && if [ "$USER_GID" != "1000" ]; then groupmod node --gid $USER_GID; fi && if [ "$USER_UID" != "1000" ]; then usermod --uid $USER_UID node; fi && apt-get install -y sudo && echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/node && chmod 0440 /etc/sudoers.d/node && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && npm install -g gatsby-cli && npm install
[104 ms] ---> Using cache
---> ecb1a4bbb610
[104 ms] Step 6/6 : CMD ["bash"]
[104 ms] ---> Using cache
---> 4b40397244fc
[105 ms] Successfully built 4b40397244fc
[113 ms] Successfully tagged vsc-ferienwohnung_walther-f2cd21b5a0eb18ef2a7ad25ba128b053:latest
[118 ms] Start: Run: git rev-parse --show-toplevel
[128 ms] Start: Starting container
[128 ms] Start: Run: docker run -a STDOUT -a STDERR -p 127.0.0.1:8000:8000 --mount type=bind,source=/home/philipp/Projects/Ferienwohnung_Walther,target=/workspaces/Ferienwohnung_Walther,consistency=cached -l vsch.quality=stable -l vsch.remote.devPort=0 -l vsch.local.folder=/home/philipp/Projects/Ferienwohnung_Walther --entrypoint /bin/sh vsc-ferienwohnung_walther-f2cd21b5a0eb18ef2a7ad25ba128b053 -c echo Container started ; while sleep 1; do :; done
[734 ms] Container started
[745 ms] Start: Inspecting container
[750 ms] Start: Run in container: uname -m
[1005 ms] x86_64
[1005 ms]
[1005 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[1006 ms] PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
[1006 ms]
[1007 ms] Start: Run in container: cat /etc/passwd
[1008 ms] Start: Updating configuration state
[1009 ms] Start: Setup shutdown monitor
[1011 ms] Forking shutdown monitor: /home/philipp/.vscode/extensions/ms-vscode-remote.remote-containers-0.94.0/dist/shutdownMonitorProcess /run/user/1000/vscode-remote-containers-46e7b8adba2ed8d9f9924860b5b3558d79c7fa06.sock singleContainer Info
[1014 ms] Start: Run in container: test -d /root/.vscode-server
[1015 ms]
[1015 ms]
[1015 ms] Exit code 1
[1015 ms] Start: Run in container: test -d /root/.vscode-remote
[1015 ms]
[1015 ms]
[1015 ms] Exit code 1
[1016 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[1017 ms]
[1017 ms]
[1017 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && cat >'/root/.vscode-server/data/Machine/settings.json' <<'settingsJSON'
[1019 ms]
[1019 ms]
[1019 ms] Start: Run in container: # Copy .gitconfig
[1022 ms]
[1022 ms]
[1023 ms] Start: Run in container: test -d /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0
[1023 ms]
[1023 ms]
[1023 ms] Exit code 1
[1023 ms] Installing VS Code Server for commit 26076a4de974ead31f97692a0d32f90d735645c0
[1023 ms] Start: Run in container: mkdir -p /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1578132510402
[1024 ms]
[1024 ms]
[1025 ms] Start: Run: docker exec -w /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1578132510402 -u root -i 1a22cf666c2dcc444f05f998b4ce810dfb7c0b505303bb11967a12cabf3b1a3c tar --no-same-owner -xz --strip-components 1
[2130 ms]
[2130 ms]
[2131 ms] Start: Run in container: mv -n /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1578132510402 /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0
[2132 ms]
[2132 ms]
[2132 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[2133 ms]
[2133 ms]
[2134 ms] Start: Run in container: cd /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0; export VSCODE_AGENT_FOLDER=/root/.vscode-server; /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0/server.sh --install-extension dbaeumer.vscode-eslint --install-extension formulahendry.auto-rename-tag --install-extension mgmcdermott.vscode-language-babel --install-extension eamodio.gitlens --install-extension gruntfuggly.todo-tree --install-extension esbenp.prettier-vscode --install-extension jpoissonnier.vscode-styled-components --install-extension naumovs.color-highlight --force
[15166 ms] Installing extensions...
Installing extension 'dbaeumer.vscode-eslint' v2.0.11...
Extension 'dbaeumer.vscode-eslint' v2.0.11 was successfully installed.
Installing extension 'formulahendry.auto-rename-tag' v0.1.1...
Extension 'formulahendry.auto-rename-tag' v0.1.1 was successfully installed.
Installing extension 'mgmcdermott.vscode-language-babel' v0.0.25...
Extension 'mgmcdermott.vscode-language-babel' v0.0.25 was successfully installed.
Installing extension 'eamodio.gitlens' v10.2.0...
Extension 'eamodio.gitlens' v10.2.0 was successfully installed.
Installing extension 'gruntfuggly.todo-tree' v0.0.162...
Extension 'gruntfuggly.todo-tree' v0.0.162 was successfully installed.
Installing extension 'esbenp.prettier-vscode' v3.18.0...
Extension 'esbenp.prettier-vscode' v3.18.0 was successfully installed.
Installing extension 'jpoissonnier.vscode-styled-components' v0.0.27...
Extension 'jpoissonnier.vscode-styled-components' v0.0.27 was successfully installed.
Installing extension 'naumovs.color-highlight' v2.3.0...
Extension 'naumovs.color-highlight' v2.3.0 was successfully installed.
[15166 ms]
[15167 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.postCreateCommandMarker' ; } 2> /dev/null
[15168 ms]
[15168 ms]
[15168 ms] Start: Run in container: test -f /root/.vscode-server/.postCreateCommandMarker
[15168 ms]
[15168 ms]
[15168 ms] Exit code 1
[15169 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink -f /proc/$pid/cwd ; xargs -0 < /proc/$pid/environ ; xargs -0 < /proc/$pid/cmdline ; } ; echo ; done 2>/dev/null
[15181 ms] Start: Run: docker exec -w /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0 -u root -e SHELL=/bin/bash -e VSCODE_AGENT_FOLDER=/root/.vscode-server 1a22cf666c2dcc444f05f998b4ce810dfb7c0b505303bb11967a12cabf3b1a3c /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0/server.sh --disable-user-env-probe --port 0
[15660 ms]
*
* Visual Studio Code Server
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license https://aka.ms/vscode-remote/license
*
[15694 ms] IP Address: 172.17.0.3
[15696 ms] Extension host agent listening on 45223
[15696 ms] Start: Run in container: echo 45223 >/root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0/.devport
[15696 ms]
[15696 ms] [10:08:45] Extension host agent started.
[15697 ms]
[15697 ms]
[15697 ms] Forwarding local port 45223 to container port 45223
[15697 ms] Start: Setting up SSH authentication socket.
[15698 ms]
--------------------------
Published Ports:
8000/tcp -> 127.0.0.1:8000
--------------------------
Notifications:
Could not fetch remote environment
Failed to connect to the remote extension host server (Error: connect ECONNREFUSED ::1:37469)
VS Code window log:
[2020-01-04 10:44:22.405] [renderer1] [error] [remote-connection][ExtensionHost][563bd…][initial][localhost:37469] socketFactory.connect() failed. Error:
[2020-01-04 10:44:22.406] [renderer1] [error] Error: connect ECONNREFUSED ::1:37469
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
[2020-01-04 10:44:22.406] [renderer1] [error] [remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:
[2020-01-04 10:44:22.406] [renderer1] [error] Error: connect ECONNREFUSED ::1:37469
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
[2020-01-04 10:44:22.407] [renderer1] [error] [remote-connection][Management ][71630…][initial][localhost:37469] socketFactory.connect() failed. Error:
[2020-01-04 10:44:22.407] [renderer1] [error] Error: connect ECONNREFUSED ::1:37469
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
[2020-01-04 10:44:22.407] [renderer1] [error] [remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:
[2020-01-04 10:44:22.407] [renderer1] [error] Error: connect ECONNREFUSED ::1:37469
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
[2020-01-04 10:44:22.666] [renderer1] [error] connect ECONNREFUSED ::1:37469: Error: connect ECONNREFUSED ::1:37469
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
[2020-01-04 10:44:22.667] [renderer1] [error] Could not fetch environment: Error: Could not fetch environment
at file:///opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.js:3798:126
at processTicksAndRejections (internal/process/task_queues.js:89:5)
[2020-01-04 10:44:22.667] [renderer1] [error] connect ECONNREFUSED ::1:37469: Error: connect ECONNREFUSED ::1:37469
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
[2020-01-04 10:56:49.757] [renderer1] [error] Could not fetch environment: Error: Could not fetch environment
at file:///opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.js:3798:126
The result: VS Code Error State
Steps I have tried
install older versions of the extension to check for a regression
try vs code insider
create a new container file with a template from vs code
At this point I think I know little about how the extension works to debug this any further. It would be great if you could point me to more steps I could try.
Thank you

Resources