I want to open my Docker server up for others to access, before the attempt to do so, I shut the current daemon down.
$ sudo service docker stop
Once the Docker daemon has been stopped, I tried to restart it manually and open it
up to outside users with the following command.
$ sudo docker daemon -H tcp://0.0.0.0:2375
What I get is
I tried with -d instead of daemon, still the same.
My current docker version is Docker version 18.09.2, build 6247962
Related
Even though my user is on docker group and I can launch docker without sudo, and I'm running idea.sh from my user, whenever I try to connect to docker from within Intellij Idea docker plugin, I get
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I'm trying the Unix socket method. I already tried multiple restarts and logout.
I'm on Ubuntu 20.04 and Intellijd Idea 2020.3
Adding current user to docker group worked for me:
sudo gpasswd -a ${USER} docker
You might need to create group first:
sudo groupadd docker
restart your OS after those changes
For me it work
sudo chmod 0777 /var/run/docker.sock
Then test this in the terminal without the sudo
docker ps -a
normally you should have access to the docker process
I got the following error when I run docker. Does anybody know how to fix the problem. The OS is Mac OS X.
$ docker --version
Docker version 17.12.0-ce, build c97c6d6
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
You can restart Docker with the following
Stop Docker for Mac gracefully
Stop all Docker containers without confirmation (make sure nothing is running in Docker)
docker ps -q | xargs -L1 docker stop
Requires all Docker containers are stopped
test -z "$(docker ps -q 2>/dev/null)" && osascript -e 'quit app "Docker"'
Start Docker gracefully
open --background -a Docker
I just found out that I have to restart my docker desktop as well. I had no idea that docker desktop and terminal's docker command are related. But now, apparently, they are related. If anyone encounters similar problems, remember to try restart your docker desktop and wait for it to get running!
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 tried installing the docker using the linux method.
However when the command $docker run hello-world is executed, it outputs:
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.
What can be done about this?
First of all make sure the daemon is running:
$ps aux|grep "docker daemon"|grep -v "grep"
A) The daemon is not launched (no lines are returned by the ps)
Start the daemon that is not working:
$sudo /usr/bin/docker daemon -H unix:///var/run/docker.sock
Or start it as a service with:
$sudo /usr/sbin/service docker start
At this point the daemon is launched.
B) The daemon is launched
As shown by the ps with something like:
[..] /usr/bin/docker daemon -H unix:///var/run/docker.sock
You're good to go with your first container with a:
$sudo docker run hello-world.
sudo and docker
If you want to use docker without being sudo (this you should, though you must be aware of the security warning!) a good read of this will help you.
You have to run this command as sudo.
sudo docker run hello-world
This will give you enough privileges to perform that action.
If you want to enable your user to rung docker without sudo, then check out this answer.
I just started playing with docker. The first thing I did was to install it, and then install Rstudio-server. (I'm running ubuntu 14.04)
sudo apt-get install docker.io
sudo docker run -d -p 8787:8787 -e USER='some_user_name' -e PASSWORD='super_secret_password' rocker/hadleyverse
Is it possible to run a docker rstudio server without sudo? If so, how?
Thanks!
From this answer:
The docker manual has this to say about it:
Giving non-root access
The docker daemon always runs as the root user, and since Docker version 0.5.2, 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 so, by default, you can access it with sudo.
Starting in version 0.5.3, if you (or your Docker installer) create a Unix group called docker and add users to it, then the docker daemon will make the ownership of the Unix socket read/writable by the docker group when the daemon starts. The docker daemon must always run as the root user, but if you run the docker client as a user in the docker group then you don't need to add sudo to all the client commands. As of 0.9.0, you can specify that a group other than docker should own the Unix socket with the -G option.
Warning: The docker group (or the group specified with -G) is root-equivalent; see Docker Daemon Attack Surface details.
Example:
Add the docker group if it doesn't already exist.
sudo groupadd docker
Add the connected user "${USER}" to the docker group. Change the user name to match your preferred user.
sudo gpasswd -a ${USER} docker
Restart the Docker daemon:
sudo service docker restart
If you are on Ubuntu 14.04 and up use docker.io instead:
sudo service docker.io restart
You need to log out and log back in again if you added the current logged in user.