Directory Nonexistent when Attaching VSCode to running Docker Container - docker

I have a running docker container. I was previously able to connect to this container. During use, I was disconnected. Attempts to reconnect to the docker container (or other variations thereof) are unsuccessful. I've included the logs for this below.
[225 ms] Dev Containers 0.275.1 in VS Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164).
[225 ms] Start: Resolving Remote
[227 ms] Setting up container: container_name_redacted
[227 ms] Host: host_redacted
[230 ms] Start: Run: host_redacted /bin/sh
[251 ms] Start: Run in host: id -un
[3684 ms] name_redacted
[3685 ms]
[3685 ms] Start: Run in host: cat /etc/passwd
[3702 ms] Start: Run in host: echo ~
[3719 ms] /home/name_redacted
[3720 ms]
[3721 ms] Start: Run in host: test -x '/home/name_redacted/.vscode-remote-containers/bin/e2816fe719a4026ffa1ee0189dc89bdfdbafb164/node'
[3738 ms]
[3738 ms]
[3739 ms] Start: Run in host: test -f '/home/name_redacted/.vscode-remote-containers/dist/vscode-remote-containers-server-0.275.1.js'
[3756 ms]
[3756 ms]
[3769 ms] userEnvProbe: loginInteractiveShell (default)
[3770 ms] userEnvProbe: not found in cache
[3770 ms] userEnvProbe shell: /bin/bash
[3852 ms] userEnvProbe PATHs:
Probe: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
Container: None
[3871 ms] Start: Run in Host: docker inspect --type container /redacted_container_name
[3933 ms] Start: Check Docker is running
[3933 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[3999 ms] Server API version: 1.41
[4047 ms] Command failed: /bin/sh -c cat >'/tmp/devcontainer-config-91de0ba6-e023-476c-b3a0-df813264bd3f.json'
[4047 ms] /bin/sh: 1: cannot create /tmp/devcontainer-config-91de0ba6-e023-476c-b3a0-df813264bd3f.json: Directory nonexistent
[4047 ms] Exit code 2
It looks like it cannot access the /tmp/ directory. I've tried mapping this directory to the container using -v. I've also tried opening up permissions. I've tried creating the container specific to my user. I've tried using privileged parameter. I'm at a loss here.

Related

Cannot Attach to Docker Container on VSCode Reload

I am working on a remote server via SSH where docker live.s.
I have created a container with the following code:
docker run -it -d --name <name> -v /data/data:/data python:3.8 /bin/bash
I then attach to the container in VS Code using:
F1 -> "Dev Containers: Attach to Running Container"
I can reload the window fine here. No issues. When I add a folder to the workspace and then reload the window, I am unable to connect to the container anymore. I get an error:
[3888 ms] Start: Run in Host: docker inspect --type container /<name>
[3946 ms] Start: Check Docker is running
[3946 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[4010 ms] Server API version: 1.41
[4054 ms] Command failed: /bin/sh -c cat >'/tmp/devcontainer-config-473d3a31-3938-4870-8f48-d97ddccdab52.json'
[4055 ms] /bin/sh: 1: cannot create /tmp/devcontainer-config-473d3a31-3938-4870-8f48-d97ddccdab52.json: Directory nonexistent
[4055 ms] Exit code 2
Any ideas how to troubleshoot?
I have tried to open permissions to the tmp directory. I have tried to remove workspace folders.
Deleting the imageConfig file allows me to once again open the container in VSCode, but doesn't fix the issue permanently.
C:\Users\name\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\imageConfigs

VSCode gets disconnected from remote container constantly

I have a setup to work remotly in a vm inside a container and I have been working with these setup for several months. I followed this guide to setup my client environment.
Today it got disconnected when I removed the container (because I was building a new one), and since that moment I can't connect to work. I get connected and instantly I get disconnected. I tried several things
I closed and opened the Visual Studio Code
I restarted the computer
I did a docker system prune (both client and server)
I removed lot of docker images that were not being used
I already deleted and created a new container
The container is working, the problem is that I am getting constantly disconnected with VSCode from the container
In the logs I can read
[23918 ms] Start: Run in container: set -o noclobber ; mkdir -p '/home/root/.vscode-server/data/Machine' && { > '/home/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[24517 ms]
[24517 ms]
[24517 ms] Exit code 1
[24518 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
[25583 ms] Extension host agent is already running.
[25583 ms] Start: Run in container: cat /home/root/.vscode-server/bin/58bb7b2331731bf72587010e943852e13e6fd3cf/.devport 2>/dev/null
I think that maybe that Exit code 1 can be telling that something is not right

Docker container after restart:- Failed to connect to bus: No such file or directory

I have created a docker container with the below command.
docker run -it -d --privileged=true Debian-base init
After restart this container when I tried to start any service using systemctl or service or /etc/init.d/ got below error message.
Failed to connect to bus: No such file or directory

pending when starting a container on remote host

I have already configured remote api for docker in my server.
$ ps -ef |grep dockerd
root 5191 1 0 5월08 ? 00:01:41 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:4243
When I run a container in a Jenkins container running in my server,
The container is pended after creating the container.
[Execute Shell]
export DOCKER_HOST=tcp://10.254.239.53:4243
docker run -it --rm ubuntu:18.04 ls
<--- pending and display nothing
The result of docker ps -a in my server
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
609198e3928d ubuntu:18.04 "ls" 8 seconds ago Created lucid_curran
When I execute the same command with "-d" option, it is ok. But useless.
[Execute Shell]
export DOCKER_HOST=tcp://10.254.239.53:4243
docker run -d ubuntu:18.04 ls
When I run the same command in my server, executed correctly.
$ docker run --rm -it ubuntu:18.04 ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
How do I fix this error?

Docker: error during connect

I am getting the above error whenever i am trying to use RSelenium package
shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
docker: error during connect: Post
http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/containers/create: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
See 'docker run --help'.
Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c docker run -d -p
4445:4444 selenium/standalone-chrome' had status 127
2: In shell("docker run -d -p 4445:4444 selenium/standalone-chrome") :
'docker run -d -p 4445:4444 selenium/standalone-chrome' execution failed with error code 127
Check the stauts of docker environment variables which is not properly set. Kindly, check with the below command,
docker-machine env box
(Note: By default the env set for docker-machine is default)
Otherwise you can set it as like the below
$ set | grep DOCKER
DOCKER_CERT_PATH=C:\Users\mohan\.docker\machine\machines\deis
DOCKER_HOST=tcp://192.168.99.100:2376
DOCKER_MACHINE_NAME=deis
DOCKER_TLS_VERIFY=1
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
deis * virtualbox Running tcp://192.168.99.100:2376 v17.03.0-ce
$ docker ps -a
time="2017-03-23T11:11:55-07:00" level=info msg="Unable to use system certificate pool: crypto/x509: system root pool is not available on Windows"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker pull busybox
time="2017-03-23T11:13:07-07:00" level=info msg="Unable to use system certificate pool: crypto/x509: system root pool is not available on Windows"
Using default tag: latest
latest: Pulling from library/busybox
7520415ce762: Pull complete
Digest: sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
Status: Downloaded newer image for busybox:latest
Hope this will work.

Resources