I tried to install the nvidia-docker after installing docker-ce. I followed this : https://github.com/NVIDIA/nvidia-docker to install nvidia-docker. It seems to have installed correctly.
I tried to run:
$ sudo docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.
Although, this works (without --runtime=nvidia):
$ docker container run -ti ubuntu bash
Some additional info on my system: It is an ubuntu server 16.04 with 8 GPUs (Titan Xp) and nvidia driver version 387.26. I can run nvidia-smi -l 1 on the host system and it works as expected.
$ dpkg -l | grep -E '(nvidia|docker)'
ii docker-ce 18.06.1~ce~3-0~ubuntu amd64 Docker: the open-source application container engine
ii libnvidia-container-tools 1.0.0-1 amd64 NVIDIA container runtime library (command-line tools)
ii libnvidia-container1:amd64 1.0.0-1 amd64 NVIDIA container runtime library
ii nvidia-container-runtime 2.0.0+docker18.06.1-1 amd64 NVIDIA container runtime
ii nvidia-container-runtime-hook 1.4.0-1 amd64 NVIDIA container runtime hook
ii nvidia-docker2 2.0.3+docker18.06.1-1 all nvidia-docker CLI wrapper
$ cat /etc/docker/daemon.json
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
}
}
I have come across: https://github.com/NVIDIA/nvidia-docker/issues/501, but I am not sure how I should go about it.
From nvidia-docker github repo:
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
Actually, you can try to restart docker daemon by following command.
sudo systemctl daemon-reload
sudo systemctl restart docker
Or you can try to reboot your system.
to make nvidia-docker work
This is how I resolve the above problem for CentOS 7; hopefully it can help anyone who has similar problems.
Add necessary repos to get nvidia-container-runtime:
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.repo | sudo tee /etc/yum.repos.d/nvidia-container-runtime.repo
(Optional) In my case, I disabled the experimental repos:
sudo yum-config-manager --disable libnvidia-container-experimental
sudo yum-config-manager --disable nvidia-container-runtime-experimental
Install nvidia-container-runtime package:
sudo yum install nvidia-container-runtime
Update docker daemon:
sudo vim /etc/docker/daemon.json
with the path to nvidia-container-runtime:
{
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}
Finally, you need to make docker update the path:
sudo pkill -SIGHUP dockerd
It seems you may need to purge docker and reinstall it as in the post:
github issues
sudo apt remove docker-ce
sudo apt autoremove
sudo apt-get install docker-ce=5:18.09.0~3-0~ubuntu-bionic
sudo apt install nvidia-docker2
From nvidia-docker Frequently Asked Questions:
Why do I get the error Unknown runtime specified nvidia?
Make sure the runtime was registered to dockerd. You also need to reload the configuration of the Docker daemon.
Change the --runtime=nvidia tag to --runtine=gpus all hopefully it will run
Related
I installed docker with the following command:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-ce
But when I run docker ps, I get the following error:
XXXXX#DESKTOP-XXXXX:~$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
You cannot run Docker on WSL directly (you don't have the same kernel capabilities that you have with Linux distros).
You can run Docker in HyperV and configure you Docker client in WSL to connect to it: https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly
Or start experimenting with WSL 2 Docker backend (it's not that mature, probably has a lot more limitations and bugs): https://docs.docker.com/docker-for-windows/wsl-tech-preview/
You should start the docker service, for Debian distro you can run the command:
sudo service docker start
or run the docked command
I'm new to docker. I'm following the instructions on the friendlyhello tutorial. I'm running this on a CentOS 7.5 virtual machine, docker --version is 1.13.1. I get to the point where I run docker run -d -p 4000:80 friendlyhello and get :
$ docker run -p 4000:80 friendlyhello
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint eager_dijkstra (f022a7a52040c54a54d94270e94a4149554be38514c88cb933d77440f43f6092): exec: "docker-proxy": executable file not found in $PATH.
If I run it again :
$ docker run -p 4000:80 friendlyhello
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint amazing_wiles (cfb767520e0f130d93cb881917320555ea3eccd605dd845b978e062e1aca3b57): Bind for 0.0.0.0:4000 failed: port is already allocated.
I do not have a docker-proxy executable on my machine.
QUESTION :
How do I get friendlyhello to run? Where is docker-proxy?
Evidently I installed docker through just the default yum repos, e.g. yum install docker. This got me docker version 1.13.1. This is incorrect (and non-intuitive), I needed to install it following these instructions from the docker website. This got me docker-proxy and allowed me to run the friendlyhello example (docker version 18.06.1-ce). Reposting the instructions :
## Clean up my previous install
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
### This is the repo to get the correct docker distribution
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce
I also faced exact same issue.
Removing docker completely and installing from official website solved my issue.
Offical Link
I am trying to set up whole docker eco system in ubuntu linux running in virtualbox. I succeed in installing docker engine. But I cannot install docker compose and docker machine. Below are the steps I followed to install docker machine.
$ base=https://github.com/docker/machine/releases/download/v0.14.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker- machine &&
sudo install /tmp/docker-machine /usr/local/bin/docker-machine
I am getting below error
/usr/local/bin/docker-machine: line 1: Not: command not found
While running the command docker-machine --version
first uninstall older versions first
sudo apt-get remove docker docker-engine docker.io
Update the apt package index:
$ sudo apt-get update
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
this 4 lines are one single command. copy paste it.
sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker#docker.com>
sub 4096R/F273FCD8 2017-02-22
set up the stable repository. You always need the stable repository,
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Update the apt package index one more time.
sudo apt-get update
Install the latest version of Docker CE
sudo apt-get install docker-ce
test if it is installed
docker --version
INSTALL DOCKER COMPOSE
Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
test it
docker-compose --version
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
docker-ce
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/33,8 MB of archives.
After this operation, 181 MB of additional disk space will be used.
(
Reading database ... 129600 files and directories currently installed.)
Preparing to unpack .../docker-ce_18.03.1~ce-0~ubuntu_amd64.deb ...
Unpacking docker-ce (18.03.1~ce-0~ubuntu) ...
dpkg: error processing archive /var/cache/apt/archives/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb (--unpack):
trying to overwrite '/usr/bin/docker-containerd', which is also in package docker-containerd 0.2.3+git+docker1.13.1~ds1-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I got this error when trying to install the latest Docker (v20.10.17) on Ubuntu Focal 20.04 (LTS) following the official documentation. I tried installing older versions and got the same error. When running sudo dockerd --debug it showed the real error:
failed to start daemon: Devices cgroup isn't mounted
Cgroupfs (Control Groups) are a kernel mechanism for tracking and imposing limits on resource usage on groups of tasks. So the solution is to mount it. Note that you need to stop the container daemon before mounting the cgroup and then start it again after that.
Stop daemon
sudo systemctl stop containerd
Unmount (just in case) and then mount the cgroup
sudo cgroupfs-umount
sudo cgroupfs-mount
Start the daemon again
sudo systemctl start containerd
sudo systemctl start docker.service
sudo systemctl start docker.socket
If there are errors still, re-install everything
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Test that Docker works
sudo docker run hello-world
I don't see 18.04 listed on the supported list so you may be encountering compatibility issues that the developers have not had time to resolve. To work around your immediate issue, I would uninstall "docker-containerd" and any other dependent packages since that appears to be based on a very old version of docker (1.13).
apt remove docker-containerd
Step 01 - Uninstall old version of Docker
$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ sudo rm -rf /var/lib/docker
$ sudo apt-get autoclean
$ sudo apt-get update
Step 02 - Install Docker-ce:
Install a few prerequisite packages which let APT use packages over HTTPS:
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add the GPG key for the official Docker repository to system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT source:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
Update the package database
$ sudo apt update
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo
$ apt-cache policy docker-ce
Finally, install Docker:
$ sudo apt install docker-ce
Verify docker is running
$ sudo systemctl status docker
I'm looking to use Docker compose with v2 docker-compose.yml syntax.
When I'm following the documentation (https://store.docker.com/editions/community/docker-ce-server-ubuntu?tab=description) old docker and docker-compose version has installed :
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
$ sudo apt-get update
$ sudo apt install docker docker-compose
.../...
$ dpkg -l |grep docker
ii docker 1.5-1 amd64 System tray for KDE3/GNOME2 docklet applications
rc docker-ce 17.03.1~ce-0~ubuntu-yakkety amd64 Docker: the open-source application container engine
ii docker-compose 1.5.2-1 all Punctual, lightweight development environments using Docker
ii docker.io 1.12.6-0ubuntu1~16.10.1 amd64 Linux container runtime
ii python-docker 1.8.0-0ubuntu1 all Python wrapper to access docker.io's control socket
ii python-dockerpty 0.4.1-1 all Pseudo-tty handler for docker Python client (Python 2.x)
In order to use version 2 docker compose file format I need more recent version.
Documentation page of Docker Compose : https://github.com/docker/docker.github.io/blob/master/compose/compose-file/compose-versioning.md
Version 2 files are supported by Compose 1.6.0+ and require a Docker
Engine of version 1.10.0+.
How do I get recent version of docker engine & docker compose ?
I googled this many times today without fine any "simple" solution.
My system : Ubuntu 16.10
Thanks for your help,
David
The easiest way to install Docker is to run:
curl -sSL https://get.docker.com/ | sh
You will probably need to run apt-get remove docker docker-compose first.
To install docker-compose, I normally grab the latest release from the docker-compose Github project e.g:
curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose