I was trying to do something, but I have accidentally deleted docker folder at var/lib/docker, and now I can not install another docker any more. What to do now? How can I fix this problem and install new docker.
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pulling fs layer
docker: open /var/lib/docker/tmp/GetImageBlob974250330: no such file or directory.
See 'docker run --help'.
have you tried to simply restart docker this way?
systemctl restart docker
or
sudo service docker stop
sudo service docker start
Related
Yes I have followed steps provided here https://docs.docker.com/engine/install/ubuntu/ and https://docs.docker.com/engine/install/linux-postinstall/ and also checked this thread docker.sock permission denied
But still getting the below problem when docker is run without sudo in Ubuntu 18.04
docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
It is rather frustrating as I tried multiple times.
It worked fine after deleting the below entry in .bashrc
export DOCKER_HOST=unix:///run/user/1000/docker.sock
I'm not sure how that line made it into .bashrc
Feel so stupid now. Anyway thanks!
I am trying to build a new docker image.
docker build . -t tg
.....
.....
Removing intermediate container ba85d1deadeb
---> 353fcb84af6b
Successfully built 353fcb84af6b
Successfully tagged tg:latest
But for some reason, after it is successfully built I could neither run it nor find it.
docker images
<none> <none> c18e928477c3 11 days ago 1.01GB
...... a long list of unrelated images that are intermediate steps of the built process .....
docker image ls , docker images -a aren't helping either.
sudo docker run -i -t 353fcb84af6b
Unable to find image '353fcb84af6b:latest' locally
docker: Error response from daemon: pull access denied for 353fcb84af6b, repository does not exist or may require 'docker login'.
See 'docker run --help'.
when running docker run -i -t tg:latest result is the same.
The issue seems to be specific to THIS particular image... Other successfully built images DO show up after running docker images.
Dockerfile
Any pointers are much appreciated.
On linux
try:
docker buildx build --progress=plain --load .
1- In order to run docker commands, use sudo user.
WHY -> The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo.
Get your images build with sudo docker build -t tag_name --no-cache .
To see the images - sudo docker images
Also, you cannot use tag with image ID - Unable to find image '353fcb84af6b:latest' locally
In order to run your image, you can either use JUST image ID or image_name:tag.
I followed the official guide and installed docker-ce on Ubuntu 18.04 x64.
Per the instructions on Manage Docker as a non-root user, I tried to modify the ownership of .docker folder, and got a "No such file or directory" error:
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
chown: cannot access '/home/eric/.docker': No such file or directory
In fact, I don't even have a .docker folder:
$ ls ~/.docker
ls: cannot access '/home/eric/.docker': No such file or directory
In an earlier step, I was able to run the hello-world container successfully:
$ sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
What did I do wrong?
Having the same problem. It finally worked for me after I restarted my laptop (which is running Ubuntu 18.04). Logging out and back in wasn't enough.
Manually created the .docker folder using mkdir .docker before restarting though.
The directory .docker (and the file .docker/config.json) will be created when you successfully authenticate to a Docker registry e.g Docker Hub running the command docker login.
(This presupposes $USER is part of the group docker.)
I have a problem after I have tried to restart docker. Since then,
service docker start returns "start: Job failed to start".
This may have started once I have changed docker.conf. I have tried to reupload it using the command
wget -O /etc/init/docker.conf https://raw.githubusercontent.com/docker/docker/master/contrib/init/upstart/docker.conf
however, I was not lucky to fix this.
cat /var/log/upstart/docker.log returns:
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Any help would be really appreciated.
You likely have an old version of docker installed; the docker daemon subcommand was added in docker 1.8. Before that, the daemon was started using the -d / --daemon option (docker -d).
The version of the upstart-configuration you downloaded is intended for the current docker release; for older versions of docker, be sure to download the version that matches the version you've installed, for example;
https://raw.githubusercontent.com/docker/docker/v1.7.1/contrib/init/upstart/docker.conf
I would suggest to upgrade to a more recent version of docker, because versions older than 1.8 are now getting quite old (in Docker terms)
In my case, after upgrade to docker 19.03.5, I got this error.
When starting manually the /usr/bin/dockerd all works but via systemctl start docker it fails.
Looking at journalctl -xe I found the log:
docker: 'daemon' is not a docker command.
But the docker.service file was right, starting /usr/bin/dockerd.
I spent a time to figure out that the previous installation had a configuration file in: /etc/systemd/system/docker.service.d/override.conf that replace the docker daemon start command(/usr/bin/dockerd) with other deprecated syntax.
In this case you can remove the override.conf file to allow docker start:
rm /etc/systemd/system/docker.service.d/override.conf
systemctl daemon-reload
systemctl start docker
Hope it helps
I built a docker image from a docker file. Build said it succeeded. But when I try to show docker containers through docker ps (also tried docker ps -a), it shows an empty list. What is weird is that I'm still able to somehow push my docker image to dockerhub by calling docker push "container name".
I wonder what's going on? I'm on Windows 7, and just installed the newest version of dockertoolbox.
docker ps shows (running) containers. docker images shows images.
A successfully build docker image should appear in the list which docker images generates. But only a running container (which is an instance of an image) will appear in the list from docker ps (use docker ps -a to also see stopped containers). To start a container from your image, use docker run.
For me, docker ps -a and docker images both returned an empty list even tho I had many docker containers running. I tried rebooting system with no luck. A quick sudo systemctl restart docker fixed this "bug".
try restarting
sudo systemctl restart docker.socket
sudo systemctl restart docker
You can run the command without the -d option.
So you have the output displayed.
It may be that the application failed to start.
For me, the only thing resolving the issue is to reinstall docker. Also, one must be sure that the disk is not full.
This is the command that I use, but it may vary depending on the version of docker already installed:
apt-get install --reinstall docker.io
If prompted, choose "yes" to automatically restart docker daemon
for Linux,
at first, see all the running container
sudo docker ps
try restarting
sudo systemctl restart docker
remove previous docker image with the same name if there is any
sudo docker rm docker_container_id
once again run
sudo docker run -d --name container_name image_name
This should work
or uninstall docker and install it again
In the Dockerfile instructions, make sure the CMD commands are in between double-quotes not single-qoute
for example:
CMD [ "node" , 'index.js'] Here there is a mistake !!
Correct one is :
CMD [ "node" , "index.js"]
This mistake will make the container run and exit immediately.