Docker not found after restarting on Ubuntu 18 - docker

Hello I'm stuck with an issue with docker. After forcing my laptop to shut down, docker which was working fine before now spits out the following error
docker-compose build && docker-compose up
dev_db uses an image, skipping
Building dev_server
ERROR: Couldn't connect to Docker daemon - you might need to run docker-machine start default.
I get an error on running docker-machine start default (both with sudo and without), and as I try to create a new machine with docker-machine create default, I run into the following. docker itself is still installed as I can see the commands as I enter docker.
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox > is installed and VBoxManage is in the path"
sudo service docker restart results in the following
Failed to restart docker.service: Unit docker.service not found.
and sudo docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
and systemctl status docker.service
Unit docker.service could not be found.
I also tried restarting my laptop and logging in and out again. I'm really puzzled by this and I'd appreciate any help!

Docker is installed but the daemon is not!
There are many reasons why the devil may not be running
Maybe is storage driver
Try this steps first
Disable Docker service: sudo systemctl stop docker.service
And then start Docker Daemon (overlay driver): sudo docker daemon -s overlay
Then edit /etc/default/docker file and add the option:
DOCKER_OPTS="-s overlay"

Related

How to check docker service logs when restart and stop by: sudo systemctle restart docker or sudo systemctl stop docker?

I have an ubuntu 18.04 running on a metal server. My docker working good but one day i can not build new docker image, my build script hang without showing any error (the script working good before).
I tried to restart docker engine by: sudo systemctl restart docker but docker service can not active, the command: sudo systemcle stop docker not working too.
Then i rebooted my server then docker go back.
What log files should i check to know what make my docker service hang?
You can view the docker service logs using:
sudo journalctl -fu docker.service

docker installation in ubuntu and start problem

I'm unable to start docker service in ubuntu 18.04.
How do I install docker, and how do I start the start docker service?
When running systemctl start docker I got this error:
System has not been booted with systemd as init system (PID 1). Can't operate.
This is the error related to Ubuntu Linux service error, not by Docker
You Can Use
sudo service docker start/status/stop instead of systemctl
Instead, use: sudo service docker start
Docker doesn't require any explicit commands to start its service.
Kindly use steps shared in below like for Setting up docker in Debian i.e Linux machine
https://docs.docker.com/engine/install/debian/
you can get rid of using sudo for every command by doing this Manage Docker as a non-root user

How to exit docker?

I am new to docker and I exited the container's shell using exit and then used sudo docker stop ABC to kill the container. However, systemctl is-active docker still shows that docker is active. Is there any way to kill docker as well or would it remain active on my system forever?
I am using Ubuntu 18.
Docker daemon is supposed to keep running in background even if you exit and remove the container. This is because in case if you want to start a new container and docker daemon is not running then you won't be able to do it.
In case if you want to, then you can do sudo systemctl stop docker to stop the docker daemon completely. But after this if you do docker run -it someimage then you'll get an error - and to fix that you'll have to restart the docker daemon - sudo systemctl start docker
Hope that clarifies everything!

Docker Swarm Init Fails: Address already in use

I've been going through the docker tutorial at https://docs.docker.com/v17.12/get-started/part3/#take-down-the-app-and-the-swarm and am up to the part where we're setting up our initial docker swarm.
I had this working at first, but then had to reconcile differences between a snap install docker and apt install docker on my system. Following this, when I try to run docker swarm init I'm told:
Error response from daemon: manager stopped: failed to listen on remote API address: listen tcp 0.0.0.0:2377: bind: address already in use
I have no other docker images or services running, so I'm fine killing or deleting anything, but I can't seem to figure out how to clear up this port so that I can initialize a new swarm.
Is there a way to either A) Kill the running swarm, or B) List the available swarms so that I can join it and then kill it from there as a swarm master?
Thanks!
Seems like you have installed docker from both snap/apt and you must uninstall one of the two (one is running in swarm mode and the docker client is connecting to the one that isn't).
To find the process running swarm use the following:
sudo ss --tcp --listening --processes --numeric | grep ":2377"
This will list the processes listening on the port 2377, on my case i find:
LISTEN 0 128 *:2377 *:* users:(("dockerd",pid=1229,fd=24))
Now using the pid you can find the process location:
sudo readlink -f /proc/1229/exe
If the process comes from a snap then you know that you must stop it and remove the snap so it only leaves the inastallation from apt-get (or viseversa if you want to keep the snap installation).
On my machine, I had to restart docker:
systemctl restart docker
And then it started to work again.
After removing the snap package with sudo snap remove docker I got the error docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
After trouble shooting, the solution was to uninstall, reinstall the apt docker packages and then restart the docker service with systemctl restart docker I confirmed it worked with journalctl -xe and sudo docker run hello-world

Docker Image Build on Ubuntu: Cannot connect to the Docker daemon

I am running Ubuntu 14 in codeanywhere.com, and I'm getting "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" error when I try to build the docker image.
Also, when I try to stop docker, I'm getting "stop: Unknown instance:", looks like Docker never got started.
How should I fix this problem?
cabox#box-codeanywhere:~/workspace$ sudo service docker start
docker start/running, process 1392
cabox#box-codeanywhere:~/workspace$
cabox#box-codeanywhere:~/workspace$ sudo docker build .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
cabox#box-codeanywhere:~/workspace$
cabox#box-codeanywhere:~/workspace$
cabox#box-codeanywhere:~/workspace$ sudo service docker stop
stop: Unknown instance:
I've tried installing docker on an ubuntu-14 machine running on codeanywhere.com right now using this guide, and when the installation process was finished I found this error in /var/log/upstart/docker.log -
time="2018-02-10T03:09:22.148778137-05:00" level=fatal msg="Your Linux kernel version 2.6.32-042stab112.15 is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer."
Even if upgrading the kernel is somehow possible, I don't think codeanywhere.com is the right place to install docker on, as the env itself is probably a docker container. If you're adamant about doing this, perhaps you should contact them and check for the best course of action for your needs.

Resources