I am new to docker and haven't found a question here to answer the problem I'm experiencing.
I am tryin to use Pycharm to run a dockerfile, in order to debug certain program inside the docker.
I opened the dockerfile in pycharm, and I created a configuration for running the dockerfile.
Running the program results in an error message under the 'services' tab:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
After I Googled the problem, I found this thread: Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
Which said I should be running sudo dockerd. After some bugs I uninstalled docker completely, and installed it again.
After installation I ran:
systemctl status docker
And the output is:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-09-26 15:06:22 IDT; 59s ago
Docs: https://docs.docker.com
Main PID: 24888 (dockerd)
Tasks: 21
CGroup: /system.slice/docker.service
└─24888 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
So I stopped it using sudo service docker stop
I ran systemctl status docker again and it was indeed stopped:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sat 2020-09-26 15:09:29 IDT; 16s ago
Docs: https://docs.docker.com
Process: 24888 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=0/SUCCES
Main PID: 24888 (code=exited, status=0/SUCCESS)
Sep 26 15:06:21 DL-2 dockerd[24888]: time="2020-09-26T15:06:21.919021419+03:00" level=info msg="Loading containers: done."
Sep 26 15:06:22 DL-2 dockerd[24888]: time="2020-09-26T15:06:22.265996712+03:00" level=info msg="Docker daemon" commit=4484c46d9
Sep 26 15:06:22 DL-2 dockerd[24888]: time="2020-09-26T15:06:22.266253446+03:00" level=info msg="Daemon has completed initializa
Sep 26 15:06:22 DL-2 dockerd[24888]: time="2020-09-26T15:06:22.642407513+03:00" level=info msg="API listen on /var/run/docker.s
Sep 26 15:06:22 DL-2 systemd[1]: Started Docker Application Container Engine.
Sep 26 15:09:29 DL-2 systemd[1]: Stopping Docker Application Container Engine...
Sep 26 15:09:29 DL-2 dockerd[24888]: time="2020-09-26T15:09:29.427473508+03:00" level=info msg="Processing signal 'terminated'"
Sep 26 15:09:29 DL-2 dockerd[24888]: time="2020-09-26T15:09:29.428067483+03:00" level=info msg="stopping event stream following
Sep 26 15:09:29 DL-2 dockerd[24888]: time="2020-09-26T15:09:29.428325869+03:00" level=info msg="Daemon shutdown complete"
Sep 26 15:09:29 DL-2 systemd[1]: Stopped Docker Application Container Engine.
So I ran sudo dockerd and it seemed to run fine:
INFO[2020-09-26T15:11:03.918879915+03:00] Starting up
INFO[2020-09-26T15:11:03.919388821+03:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf
INFO[2020-09-26T15:11:03.919768789+03:00] parsed scheme: "unix" module=grpc
INFO[2020-09-26T15:11:03.919779317+03:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2020-09-26T15:11:03.919792653+03:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2020-09-26T15:11:03.919798154+03:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2020-09-26T15:11:03.920399082+03:00] parsed scheme: "unix" module=grpc
INFO[2020-09-26T15:11:03.920409757+03:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2020-09-26T15:11:03.920418642+03:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2020-09-26T15:11:03.920423441+03:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2020-09-26T15:11:04.050458554+03:00] [graphdriver] using prior storage driver: overlay2
WARN[2020-09-26T15:11:04.212728085+03:00] Your kernel does not support swap memory limit
WARN[2020-09-26T15:11:04.212780116+03:00] Your kernel does not support cgroup rt period
WARN[2020-09-26T15:11:04.212798165+03:00] Your kernel does not support cgroup rt runtime
WARN[2020-09-26T15:11:04.212812782+03:00] Your kernel does not support cgroup blkio weight
WARN[2020-09-26T15:11:04.212830211+03:00] Your kernel does not support cgroup blkio weight_device
INFO[2020-09-26T15:11:04.213206856+03:00] Loading containers: start.
INFO[2020-09-26T15:11:04.547434099+03:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
INFO[2020-09-26T15:11:04.985878757+03:00] Loading containers: done.
INFO[2020-09-26T15:11:05.259805773+03:00] Docker daemon commit=4484c46d9d graphdriver(s)=overlay2 version=19.03.13
INFO[2020-09-26T15:11:05.259975115+03:00] Daemon has completed initialization
INFO[2020-09-26T15:11:05.418371093+03:00] API listen on /var/run/docker.sock
But running the dockerfile again resulted in the same error. Im quite at a loss as to why this happens, so I would appreciate any feedback.
Should more information be needed, let me know and I'll be happy to provide.
Thanks in advance :)
Can you run docker command such as docker images without sudo? If not, you should run sudo usermod -aG docker $USER and then you can use docker command as non-root user (https://docs.docker.com/engine/install/linux-postinstall/). I'm not sure if it will solve your problem.
For Pop!_OS users:
If you installed PyCharm / PhpStorm / IntelliJ via PoP!_Shop as flatpack image:
flatpak override --user --filesystem=/run/docker.sock com.jetbrains.PyCharm-Community
Change the trailing jetbrains product name (here:PyCharm-Community) according to the used version / flavour.
Just restart the computer/laptop if other suggestions did not help. It helped me :)
Related
i have tried all of thes solutions to change the ip-address of my bridge:
Change default docker0 bridge ip address
But i allways got thes error:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-07-10 20:02:29 CEST; 9min ago
Docs: https://docs.docker.com
Process: 3130 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --bip 192.168.198.128/25 (code=exited, status=1/FAILURE)
Main PID: 3130 (code=exited, status=1/FAILURE)
Jul 10 20:02:26 Server systemd[1]: Failed to start Docker Application Container Engine.
Jul 10 20:02:29 Server systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 10 20:02:29 Server systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Jul 10 20:02:29 Server systemd[1]: Stopped Docker Application Container Engine.
Jul 10 20:02:29 Server systemd[1]: docker.service: Start request repeated too quickly.
Jul 10 20:02:29 Server systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 10 20:02:29 Server systemd[1]: Failed to start Docker Application Container Engine.
Jul 10 20:03:09 Server systemd[1]: docker.service: Start request repeated too quickly.
Jul 10 20:03:09 Server systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 10 20:03:09 Server systemd[1]: Failed to start Docker Application Container Engine.
When i try to change it via
dockerd --bip=192.168.198.128/25
Then i recived this:
INFO[2021-07-10T20:30:14.220551981+02:00] Starting up
failed to start daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid
root#Server:/etc/docker# sudo service docker stop
root#Server:/etc/docker# dockerd --bip=192.168.198.128/25
INFO[2021-07-10T20:30:27.749647728+02:00] Starting up
INFO[2021-07-10T20:30:27.751145974+02:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf
INFO[2021-07-10T20:30:27.752521878+02:00] parsed scheme: "unix" module=grpc
INFO[2021-07-10T20:30:27.752770076+02:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2021-07-10T20:30:27.752906825+02:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2021-07-10T20:30:27.753028929+02:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2021-07-10T20:30:27.756109499+02:00] parsed scheme: "unix" module=grpc
INFO[2021-07-10T20:30:27.756411626+02:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2021-07-10T20:30:27.756544438+02:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2021-07-10T20:30:27.756653280+02:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2021-07-10T20:30:27.761446487+02:00] [graphdriver] using prior storage driver: overlay2
WARN[2021-07-10T20:30:27.807419442+02:00] Your kernel does not support swap memory limit
WARN[2021-07-10T20:30:27.807711781+02:00] Your kernel does not support cgroup rt period
WARN[2021-07-10T20:30:27.807832417+02:00] Your kernel does not support cgroup rt runtime
INFO[2021-07-10T20:30:27.808384049+02:00] Loading containers: start.
ERRO[2021-07-10T20:30:28.211882902+02:00] failed to get event error="rpc error: code = Unavailable desc = transport is closing" module=libcontainerd namespace=moby
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: failed to allocate gateway (192.168.198.128): Address already in use
but i dont have it in use, not in my network and not as a ip in the config of any network-connections.
Did anybody has an idea how to change it?
Thanks bevore.
I run
systemctl status docker
and get
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-05-22 01:13:39 EDT; 2min 58s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 29937 (dockerd)
Tasks: 16
Memory: 44.2M
CGroup: /system.slice/docker.service
└─29937 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546418221-04:00" level=warning msg="Your kernel>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546439612-04:00" level=warning msg="Your kernel>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546456513-04:00" level=warning msg="Your kernel>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546810704-04:00" level=info msg="Loading contai>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.865868481-04:00" level=info msg="Default bridge>
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.027302568-04:00" level=info msg="Loading contai>
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.173496789-04:00" level=info msg="Docker daemon">
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.173625360-04:00" level=info msg="Daemon has com>
May 22 01:13:39 mbfgdell systemd[1]: Started Docker Application Container Engine.
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.258181088-04:00" level=info msg="API listen on >
but when i do
docker info
I get
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
scan: Docker Scan (Docker Inc., v0.7.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
Does anyone know what's wrong here?
(i do see a docker.pid in /var/run, however i do NOT see a docker.sock in /var/run)
After further discovery, the socket file is here
/run/docker.sock
not /var/run/docker.sock
the systemd unit file for docker.socket looks like
cat docker.socket
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target
not sure if the daemon or the client is wrong, and how to fix it???
UPDATE: hmm it seems if i create a symlink from /var/run/docker.sock to /run/docker.sock it works. Not great, but i guess i'll live with it
All docker commands do not respond, even docker logs, docker info or docker version
#: sudo systemctl stop docker doesn't respond as well
#: sudo systemctl status docker respond with:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (start) since Thu 2020-12-17 19:12:16 MSK; 27min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 7613 (dockerd)
Tasks: 22
Memory: 44.3M
CGroup: /system.slice/docker.service
└─7613 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>}" module=grpc
level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
level=info msg="[graphdriver] using prior storage driver: overlay2"
level=warning msg="Your kernel does not support CPU realtime scheduler"
level=warning msg="Your kernel does not support cgroup blkio weight"
level=warning msg="Your kernel does not support cgroup blkio weight_device"
level=info msg="Loading containers: start."
level=info msg="Container b25db26d185ef0b90061996d61cd169b820b0731d6b68a8c8c356b87293c810a failed to exit within 10 seconds of signal 15 - using the force"
level=info msg="Container ff7095aa0124b7a4afdc2036f89c4bf51e2ccd56c3430f74690aaf21e40fcbe3 failed to exit within 10 seconds of signal 15 - using the force"
I've run several containers through docker-compose before it happened. A couple of Postgres images and a couple of golang services were built statically and packed in Alpine image.
kill -9 7613 kills dockerd but it starts anyway.
Any assumptions?
When I try to pull a certain docker image, my pull fails, and then prevents me from connecting to the docker deamon again until I reboot my laptop. The Image in question is an official Jupyter images which works fine on my other machine. Restarting the Deamon does not help, but rebooting my laptop does.
I tried to docker system prune -a already, that's why there are no images on my laptop anymore. Does somebody have an idea how to fix this problem?
I think the problem might be connected to one of the images not finishing it's extraction.
EDIT
I have the same problem with a alpine image. see below
me#mylaptop $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
me#mylaptop $ docker pull jupyter/datascience-notebook
Using default tag: latest
latest: Pulling from jupyter/datascience-notebook
e6ca3592b144: Extracting [==================================================>] 28.56MB/28.56MB
534a5505201d: Download complete
990916bd23bb: Download complete
979cd14ae800: Download complete
5e8b9f8fa9e0: Download complete
6f224ed88dc4: Download complete
6ee9ec4a62a8: Download complete
7a1ae22ba760: Download complete
a1602338a8d7: Download complete
fce5135a7ea1: Download complete
e62a1c9017ef: Download complete
a5049ad1c512: Download complete
ec06c1612b0a: Download complete
acceda87b341: Download complete
939052532b6f: Download complete
d2dee4cc07fe: Download complete
4fe5e9dd4fad: Download complete
8fd08517e0c6: Download complete
7105a3ca8c38: Download complete
66c0798f609e: Download complete
94f3fc35ed38: Download complete
aa68263474a3: Download complete
6e7d1433394b: Download complete
f5902e69d9b7: Download complete
490bb991b4de: Download complete
fab6e92b04fa: Download complete
failed to register layer: Error processing tar file(exit status 1): Error cleaning up after pivot: remove /.pivot_root297865553: device or resource busy
me#mylaptop $ docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
me#mylaptop $ sudo systemctl start docker
me#mylaptop $ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-09-30 08:11:12 CEST; 15min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 908 (dockerd)
Tasks: 10
Memory: 140.8M
CGroup: /system.slice/docker.service
└─908 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
sep 30 08:11:11 mylaptop dockerd[908]: time="2020-09-30T08:11:11.992016198+02:00" level=warning msg="Your kernel does not support cgroup rt runtime"
sep 30 08:11:11 mylaptop dockerd[908]: time="2020-09-30T08:11:11.992433459+02:00" level=info msg="Loading containers: start."
sep 30 08:11:12 mylaptop dockerd[908]: time="2020-09-30T08:11:12.227615723+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can b>
sep 30 08:11:12 mylaptop dockerd[908]: time="2020-09-30T08:11:12.296603004+02:00" level=info msg="Loading containers: done."
sep 30 08:11:12 mylaptop dockerd[908]: time="2020-09-30T08:11:12.486944893+02:00" level=warning msg="Not using native diff for overlay2, this may cause degraded performance for building images: >
sep 30 08:11:12 mylaptop dockerd[908]: time="2020-09-30T08:11:12.487273874+02:00" level=info msg="Docker daemon" commit=48a66213fe graphdriver(s)=overlay2 version=19.03.12-ce
sep 30 08:11:12 mylaptop dockerd[908]: time="2020-09-30T08:11:12.491959213+02:00" level=info msg="Daemon has completed initialization"
sep 30 08:11:12 mylaptop dockerd[908]: time="2020-09-30T08:11:12.530816090+02:00" level=info msg="API listen on /run/docker.sock"
sep 30 08:11:12 mylaptop systemd[1]: Started Docker Application Container Engine.
sep 30 08:23:36 mylaptop dockerd[908]: time="2020-09-30T08:23:36.941202710+02:00" level=info msg="Attempting next endpoint for pull after error: failed to register layer: Error processing tar fi>
me#mylaptop $ docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
me#mylaptop $ docker pull alpine:3.12.0
3.12.0: Pulling from library/alpine
df20fa9351a1: Extracting [==================================================>] 2.798MB/2.798MB
failed to register layer: Error processing tar file(exit status 1): Error cleaning up after pivot: remove /.pivot_root517304538: device or resource busy
Solved it. The problem is that my kernel was/became to old.
The warning below by systemctl brought made me find this post on forums.docker.com
me#mylaptop $ systemctl status docker
...
sep 30 08:11:11 mylaptop dockerd[908]: time="2020-09-30T08:11:11.992016198+02:00" level=warning msg="Your kernel does not support cgroup rt runtime"
...
I'm running Manjaro so I upgrade my kernel with this command:
sudo mhwd-kernel -i linux54
After which docker worked again.
Following this article on Jhipster, I build the project. I, however, can't run docker-compose. So, I try to figure out the problem. I walk step by step with this Docker-Compose article without luck.
$ sudo service docker status
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-12-27 15:40:22 PST; 2 days ago
Docs: https://docs.docker.com
Main PID: 1960 (dockerd)
Tasks: 20 (limit: 4440)
Memory: 68.2M
CGroup: /system.slice/docker.service
├─1960 /usr/bin/dockerd -H fd://
└─2093 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --s
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493340278-08:00" level=warning msg="Your kernel does not support swap memory li
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493612101-08:00" level=warning msg="Your kernel does not support cgroup rt peri
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493681034-08:00" level=warning msg="Your kernel does not support cgroup rt runt
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.496381656-08:00" level=info msg="Loading containers: start."
Dec 27 15:40:17 tk-PC dockerd[1960]: time="2018-12-27T15:40:17.498415923-08:00" level=info msg="Default bridge (docker0) is assigned with an I
Dec 27 15:40:19 tk-PC dockerd[1960]: time="2018-12-27T15:40:19.646853084-08:00" level=info msg="Loading containers: done."
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.512083092-08:00" level=info msg="Daemon has completed initialization"
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.512266914-08:00" level=info msg="Docker daemon" commit=89658be graphdriver=aufs
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.553322342-08:00" level=info msg="API listen on /var/run/docker.sock"
Dec 27 15:40:22 tk-PC systemd[1]: Started Docker Application Container Engine.
$ sudo ls -la /var/run/docker.sock
srw-rw---- 1 root docker 0 Dec 27 15:39 /var/run/docker.sock
$ sudo usermod -aG docker ${USER}
$ docker-compose -f docker-compose.yml build --build-arg UID=$(id -u)
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
The result of the last step is the same as "docker-compose up -d". According to the article, it would be a permission problem if the problem still exists at this point. How can I find what permission issue?
There are multiple ways you can solve this problem. Firstly try to export environment variable of docker host with command:
export DOCKER_HOST=/var/run/docker.sock
If it works you can add the same line to your bashrc config to save this export permanently.
If it doesn't work you can try to modify docker daemon config. It located in
/etc/docker/daemon.json
You'll need to append the localhost to your hosts like that:
"hosts": ["old_hosts_not_modified_only_append_new_one", "tcp://localhost:2376"],
and restart docker daemon using command:
service docker restart
Hope it gonna help ya