sudo killall apt apt-get
If none of the above works, remove the lock files. Run in terminal:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
then reconfigure the packages. Run in terminal:
sudo dpkg --configure -a
and
sudo apt update
masum@sandbox:~$ sudo apt-get remove docker docker-engine docker-ce docker.io
masum@sandbox:~$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o
/usr/share/keyrings/docker-archive-keyring.gpg
masum@debian:~$ docker run -ti debian:latest bash
root@fe0cbc1ab553:/# cat /etc/os-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: xn--fssl-z86a
100 183 100 183 0 0 766 0 --:--:-- --:--:-- --:--:-- 766
gpg: no valid OpenPGP data found.
masum@sandbox:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
masum@sandbox:~$ sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
masum@sandbox:~$ sudo apt-get update
sudo apt-get install docker-ce=17.12.0~cd-0~ubuntu
sudo apt-get install docker-ce
masum@sandbox:~$ sudo groupadd docker
output ->groupadd: group 'docker' already exists
masum@sandbox:~$ sudo usermod -aG docker $USER
masum@sandbox:~$ docker version
Client: Docker Engine - Community
Version: 20.10.7
API version: 1.41
Go version: go1.13.15
Git commit: f0df350
Built: Wed Jun 2 11:56:47 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: b0f5bc3
Built: Wed Jun 2 11:54:58 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.6
GitCommit: d71fcd7d8303cbf684402823e425e9dd2e99285d
runc:
Version: 1.0.0-rc95
GitCommit: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
docker-init:
Version: 0.19.0
GitCommit: de40ad0
masum@sandbox:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
Status: Downloaded newer image for hello-world:latest
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/
backup docker brefore upgrade docker
masum@sandbox:~$ cd /var/lib/docker
for debian
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o
/usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-
keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get install docker-ce docker-ce-cli containerd.io
apt-cache madison docker-ce
List the versions available in your repo:
apt-cache madison docker-ce
sudo apt-get install docker-ce=17.12.0~ce-0~debian docker-ce-cli= 17.12.0~ce-0~debian
containerd.io
for ubuntu
masum@debian:~$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:10:55 2017
OS/Arch: linux/amd64
Server: Docker Engine - Community
Engine:
Version: 20.10.10
API version: 1.41 (minimum version 1.12)
Go version: go1.16.9
Git commit: e2f740d
Built: Mon Oct 25 07:41:26 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.11
GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.13.0
GitCommit: 949e6fa
masum@debian:~$ docker network create example
masum@debian:~$ docker run --rm -ti --net=example --name server ubuntu:14.04 bash
docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname
-s)-$(uname -m)" -o /usr/local/bin/docker-compose
masum@mylib:~$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$
(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 893 0 --:--:-- --:--:-- --:--:-- 893
100 12.1M 100 12.1M 0 0 1078k 0 0:00:11 0:00:11 --:--:-- 1288k
masum@mylib:~$ sudo chmod +x /usr/local/bin/docker-compose
masum@mylib:~$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
masum@mylib:~$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-composemasum@mylib:~$ whereis
docker-compose
docker-compose: /usr/bin/docker-compose /usr/local/bin/docker-compose