Unable to run Watchtower - FATA[0000] /var/run/docker.sock: no such file or director - docker-watchtower

Everyone.
I'm running Docker
Client:
Version: 1.8.2
API version: 1.20
Go version: go1.4.2
Git commit: 0a8c2e3
Built: Thu Sep 10 19:19:00 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.8.2
API version: 1.20
Go version: go1.4.2
Git commit: 0a8c2e3
Built: Thu Sep 10 19:19:00 UTC 2015
OS/Arch: linux/amd64
on
Kernel Version: 3.16.0-53-generic
Operating System: Ubuntu 14.04.2 LTS
since few weeks and everything seems fine. I'm able to pull containers for the registry and run them without issues.
Now I wish to use Watchtower to automate their refresh. However, I have a hard time doing so. First, I have tried to run Watchtower as states in the README
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
centurylink/watchtower
but after the creation of a new image on Docker Hub and waiting for the default 5 minutes nothing happened.
So I try to access the Watchtower container to see if everything was fine but when I run docker run -t -i centurylink/watchtower /bin/bash I get
FATA[0000] Get http://unix.sock/v1.15/containers/json?all=0&size=0: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
The file unix /var/run/docker.sock exists and the user is a member of the docker group
user#server1:/$ grep 'docker' /etc/group
docker:x:999:user
UPDATE 1 - See comment
If I run docker logs container-id-of-watcher-container I get
user#server1:~$ docker logs 504ba2eb37fd
time="2016-04-18T06:54:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T06:59:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T07:04:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T07:09:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T07:14:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T07:19:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T07:24:30Z" level=info msg="Checking containers for updated images"
time="2016-04-18T07:29:30Z" level=info msg="Checking containers for updated images"
UPDATE 2
I found the issue. I should use the container name and not the image name when scoping Watchtower to a single image.
However, now the question is. How can I update private images?
Thanks.

Glad you figured it out!
I just posted about how you may use private registries as an answer to this question:
Watchtower maintainer and developer here. We actually do have support for using private registries. This is done by using a fully qualified name as the image name, ie. example.com/my-org/my-image:my-tag, as well as mounting config.json at the watchtower container root.
See the docs, specifically https://containrrr.github.io/watchtower/usage-overview/
The docs could probably be clearer, and if you feel up for the task, feel free to improve them once you get it working.

Related

Issue: Cannot connect to the Docker daemon at unix:///home/tonton/.docker/desktop/docker.sock. Is the docker daemon running?

Hello Guys when I run docker version
My docker compose version is : docker compose version
Docker Compose version v2.2.2
Client: Docker Engine - Community
Version: 20.10.18
API version: 1.41
Go version: go1.18.6
Git commit: b40c2f6
Built: Thu Sep 8 23:11:43 2022
OS/Arch: linux/amd64
Context: desktop-linux
Experimental: true
Cannot connect to the Docker daemon at unix:///home/tonton/.docker/desktop/docker.sock. Is the docker daemon running?
I am using ubuntu 22.04 version.
In my case:
I had installed docker desktop by apt in ubuntu20.04 before, but removed it later .
And when I try to check sudo docker images today there is the same issue.
Restarting docker, chown socket and some other strange ways don't work.
Suddenly I discover that there is no such socket file in docker/desktop/, but in the default location /var/run. Then trying to restore docker default context by docker context use default makes everything come back to normal.
So I think that the remained docker-desktop context takes the responsibility.....

I don't have permission to access Docker and every new terminal instance I need to run newgrp docker

I installed Docker as per suggestion on the official website. I ran into problems regarding permissions of the .sock file.
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b7f0
Built: Wed Mar 11 01:25:55 2020
OS/Arch: linux/amd64
Experimental: false
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/version: dial unix /var/run/docker.sock: connect: permission denied
I already created and recreated the docker group as well as my user to the group and logged out many times, all to continue resulting in the above error. The only thing that "solves" is running newgrp docker, but it then only works for that instance of the terminal.
How do I prevent this? I don't want to add that command to my .zshrc. It has always worked just by adding my user to the docker user.
Edit
I noticed that when running groups, docker is not there despite the thousands attempts to add my user to it. Why?
I solved it with this command: sudo setfacl -m user:gabriel:rw /var/run/docker.sock

Docker not able to pull images behind proxy TLS handshake timeout

I have latest Docker version 18.06.0 installed on CentOS 7.
My server is in a corporate network so using a proxy server to access the registry.
I have added proxy settings as per docker documentation.
But finally adding proxy settings in worked partially. i.e. now docker is using proxy to pull the image before it runs.
But now it fails giving following error:
$ sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: net/http: TLS handshake timeout.
Also, the login fails:
$ sudo docker login --username=XXXX
Password:
Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF
My proxy is pretty fast. When I’m using it to download anything from the internet using wget or curl I see 90 to 100Mbps speed.
Other applications utils on my machine such as yum are using this proxy perfectly and it works well.
Now I don’t know why only Docker has a problem in downloading the images.
The details of installation and configuration are as follow:
Version:
$ sudo docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false
OS Version:
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Docker proxy config:
$ cat /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”
after adding this configuration I have already done
sudo systemctl daemon-reload
sudo systemctl restart docker
Looking for specific help.
I have gone through most of the posts on TLS Handshake Timeout issues but didn’t get any answer or suggestions working for me.
My proxy is fine and docker is using it. I don’t understand why it gets that nasty timeout.
The config file is:
[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”
Notice that 3rd line: HTTPS_PROXY=https
Is the proxy server support HTTPS? Or there should be an error.
Maybe HTTPS_PROXY=http is correct.
By the way, a similar error is Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF
Reason is usually related with your network settings. Especially, if your Docker is set up with Proxy, make it temporary with "No Proxy" option and it should work.
Cheers
I was also facing same issue behind firewall. Follow below steps:
$ sudo vim /etc/systemd/system/docker.service.d/http_proxy.conf
[Service]
Environment=“HTTP_PROXY=http://username:password#IP:port/”
Don’t use or remove https_prxoy.conf file.
reload and restart your docker
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557*********************************8
Status: Downloaded newer image for hello-world:latest
The answers before mine point towards this direction, but neither states it clearly: Removing all https proxy settings solves this problem. I had a https-proxy.conf file just like OP's and docker pull started to work after I deleted the HTTPS_PROXY line. I know that the https proxy I use works all right so it must be a problem on Docker's side.
I found this solution on serverfault.

docker image build vs docker build

Why does my Docker client recognize docker build but not docker image build? Is the client too old? Does CLI depends on client or server?
I believe I got my Docker client and server by installing the latest Docker toolbox.
$ docker version
Client:
Version: 1.12.5
API version: 1.24
Go version: go1.6.4
Git commit: 7392c3b
Built: Fri Dec 16 06:14:34 2016
OS/Arch: windows/amd64
Server:
Version: 18.01.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: 03596f5
Built: Wed Jan 10 20:13:12 2018
OS/Arch: linux/amd64
$ docker image build
docker: 'image' is not a docker command.
See 'docker --help'.
$ docker build
"docker build" requires exactly 1 argument(s).
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
The client version is old. The new commad structure is supported with client 1.13. Check Docker CLI restructured.
There was a refactoring for the command line client to have the form:
docker <management command> <command>
The new command structure still supports the old way. For instance, the old docker ps is an alias for docker container ls and the old docker build is alias to docker image build.
As you can see from the documentation in your client version docker image build does not exist yet.

missing stack command Docker

If I use: docker stack deploy -c docker-compose.yml getstartedlab I get the error:docker: 'stack' is not a docker command.
If I run docker --help there really isn't a command like this:
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
service Manage Docker services
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
swarm Manage Docker Swarm
tag Tag an image into a repository
Did they change the way to do this? I'm just following the turorial of there site (link to tutorial)
My docker version is:
Version: 1.12.6
API version: 1.24
Go version: go1.6.3
Git commit: 78d1802
Built: Tue Jan 31 23:47:34 2017
OS/Arch: linux/amd64
The docker stack command was introduced in the version 1.13.
As you can see in the prerequisites of the tutorial they said:
"Install Docker version 1.13 or higher"
All you need to do is upgrade the docker version from 1.12 to 1.13

Resources