Installing Docker in Ubuntu, from repo. Can't find a repo - docker

I'm trying to follow the official documentation.
However, when I run the command sudo apt-get install docker-ce docker-ce-cli containerd.io
I get the following message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
Also, when running apt-cache madison docker-ce, nothing shows up in the terminal...

1. Update APT:
sudo apt-get update
2. Install these packages first:
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
3. Add GPG keys:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
4. Then add Docker repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
5. Update again:
sudo apt-get update
6. Install docker-ce, cli and containerd.io:
sudo apt-get install docker-ce docker-ce-cli containerd.io
must work - be sure to execute all commands as root or with sudo.
You can also use their script to automate everything:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo ./get-docker.sh

use curl https://get.docker.com/ | bash - this is an automated script that will work in most of the cases

Install docker is pretty straightforward:
sudo apt install docker.io

Related

Adding the most recent stable Docker repository path in Ubuntu Bionic Beaver

After following steps 1 - 3 from the official docker engine install steps for Ubuntu (updating apt packages, adding Docker’s official GPG key, and applying the command to set up the repository) I get a problem when installing the plugins for the docker engine:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Based on an answer here, it resolves this issue, however I do not understand this option lsb_release -cs in the add-apt-repository command that was used.
The docker bionic repos can be viewed here.
Based on the repo path and name from that link, would this mean that the following command is correct to add the the most recent stable docker repository?
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu/dists/bionic/stable/binary-amd64/Release"
I'm not fully sure about how this command operates, and how the options are correctly given. It doesn't make sense to me why they haven't included this in the official docker engine install steps.
Based on surmise (unfortunately), and dissecting the official command to set up the repository, this will work:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu `lsb_release -cs` stable"
To summarize, this will solve the docker ce installation problem on Ubuntu 18.04 LTS (Bionic Beaver)
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 `lsb_release -cs` stable"
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

docker: OCI runtime create failed: json: cannot unmarshal object into Go value of type []string: unknown

I've got this error after update my docker on Linux Astra (Debian based OS). It happened when I was trying to run sudo docker run hello-world
Full text of the error:
docker: Error response from daemon: OCI runtime create failed: json: cannot unmarshal object into Go value of type []string: unknown.
sudo docker -v returns Docker version 18.09.7, build 2d0083d
Thanks to Алексей Козлов from ru.stackoverflow.com. The problem can be solved with following:
Remove the broken version of Docker
dpkg -l | grep -i docker
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
Install docker-ce
sudo apt-get update
sudo apt-get 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/debian \
jessie \
stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo apt-get install docker-ce-cli
Uninstall brocken version.
See answer #volkoshkursk
Add "frozen" repo
echo "deb https://download.astralinux.ru/astra/frozen/orel-2.12/2.12.13/repository orel contrib main non-free" >> /etc/apt/sources.list
apt update
Look all available package versions.
apt-cache madison docker.io
Install oldest.
apt install -y docker.io=17.12.1-0ubuntu1

i can't install docker on ubuntu 17.10

i'am trying to install Docker on my ubuntu 17.10 so i followed the instructions on the link :
https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get update
it shows
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
shows
what can i do please ?
I had similar issues installing Docker on a Ubuntu VM. This is what worked for me.
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
apt-cache policy docker-ce
sudo apt install docker-ce
And finally sudo systemctl status docker to check if it has installed properly.
symlinking the https dir in /usrLib/apt/methods to http seems to work:
$ cd /usr/lib/apt/methods
$ ln -s http https
Make sure you dont have any sources with https:// configured after apt-get install apt-transport-https it actually overwrites the symlink with the correct files.
After that run the docker installation script:
# remove old packages
$ sudo apt-get remove docker docker-engine docker.io containerd runc
# update
$ sudo apt-get update
# install dependencies
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# fetch rep
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add stable repo
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# update
$ sudo apt-get update
# install
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
This should work (from official docs)

Can not install nvidia-docker2 under Ubuntu18.04 by default

1. Issue or feature description
Can not install nvidia-docker2 under Ubuntu18.04
2. Steps to reproduce the issue
$ cat /etc/issue
Ubuntu 18.04.1 LTS \n \l
$ docker --version
Docker version 18.06.1-ce, build e68fc7a
$ sudo apt install nvidia-docker2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-docker2 : Depends: docker-ce (= 5:18.09.0~3-0~ubuntu-bionic) but it is not installable or
docker-ee (= 5:18.09.0~3-0~ubuntu-bionic) but it is not installable
E: Unable to correct problems, you have held broken packages.
$ uname -a
Linux zixia-desktop 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
The Solution
Remove the default docker.io and install Docker from docker official repository.
The script as the following:
sudo apt-get remove docker docker-engine docker.io
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo apt-get install nvidia-docker2
Related to https://github.com/NVIDIA/nvidia-docker/issues/887

How to install docker specific version

How to install specific version of Docker(like 1.3.2)?
I am unable to find any documentation in docker official docs.
Referring this link for Ubuntu.
Following instructions install docker version 1.0.1:
$ sudo apt-get update
$ sudo apt-get install docker.io
Also, following instructions install latest version of docker 1.4.1:
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
How can I install specific version like 1.3.2?
I find easier to check available versions with
sudo apt-cache policy docker-engine
and then install the one you want:
sudo apt-get install docker-engine=1.7.1-0~trusty
It consists on simply following the instructions from docker docs https://docs.docker.com/engine/installation/ubuntulinux/, but selecting a particular version
Got the answer from this github issue comment.
Summary of above commit:-
echo deb http://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
apt-get update
apt-get install -y lxc-docker-1.3.3
If permission issue then use sudo as:
echo deb http://get.docker.com/ubuntu docker main | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo apt-get update
sudo apt-get install -y lxc-docker-1.3.3
Bonus Tip:
Don't know which version? Then hit Tab after lxc-docker- as:
sudo apt-get install -y lxc-docker-<Hit Tab here>
to see list of available docker versions.
How I did it on my laptop (btw https://get.docker.com/ubuntu/ not available anymore):
$ wget -qO- https://get.docker.com/ | sh # install resources
$ apt-cache showpkg docker-engine # show version which are available
$ apt-get install docker-engine=1.8.2-0~willy # install 1.8.2 version
$ sudo apt-mark hold docker-engine # prevent upgrade on sys upgrade
$ docker version # check installed docker version
Follow below step to install specific version of docker-ce and docker-ce-cli .
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
Find the specific version of docker-ec and docker-ce-cli . Her in this example i am looking for 19.03
apt-cache policy docker-ce | grep 19
apt-cache policy docker-ce-cli | grep 19
From above command you will get list of docker version , copy respected version.
apt-get install docker-ce=5:19.03.14~3-0~ubuntu-bionic docker-ce-cli=5:19.03.14~3-0~ubuntu-bionic
As Docker Introduces two different flavors (CE and EE) the best and easy way of installing Docker on any system. please run the below command and you do not have to do any thing.
wget -qO- https://get.docker.com/ | sh
if you want to install a specific version of a docker, you can run below command to find what all version of docker is present.
apt-cache madison docker-ce #(for ubuntu)
yum list docker-ce.x86_64 --showduplicates | sort -r #(for centos)
then select the proper version and place it in below command.
wget -qO- https://get.docker.com/ | sed 's/docker-ce/docker-ce=<DOCKER_VERSION/' | sh
Another option is to replace install -y lxc-docker in the script with install -y lxc-docker-<version>.
For example, this will install docker 1.6.2:
RUN wget -qO- https://get.docker.com/ubuntu/ | sed -r 's/^apt-get install -y lxc-docker$/apt-get install -y lxc-docker-1.6.2/g' | sh
wget -qO- https://get.docker.com/ | sed 's/lxc-docker/lxc-docker-1.6.2/' | sh
Replace 1.6.2 with the version you want.
I got version 1.6.2 years old from source on Ubuntu 16.04. This might not translate to other Docker versions:
git clone https://github.com/moby/moby docker
cd docker
git tag -l -- find your tag of interest in this list (e.g. v1.6.2)
git checkout <tag name>
sudo make build
Depending on how old your version is, you might see some errors in this step. If you see sample docker images failing to get pulled in, feel free to comment the associated lines out in the Dockerfile. You might see a lvm2 source related failure. Modify the non-existent link to the source specified here. Specifically, in my case, I had to change make Dockerfile refer to the lvm2 source code at git at git://sourceware.org/git/lvm2.git .
sudo make binary

Resources