Skip to the content.
Home Alpine Linux Docker S3CMD Go System Security MySQL InfluxDB
apt-get remove docker docker-engine docker.io containerd runc
apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

Finally, to install docker, use

CHANNEL=stable curl -fsSL test.docker.com -o get-docker.sh && sh get-docker.sh

OR

CHANNEL=stable curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Next, install docker-compose using the following command.

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 && sudo chmod +x /usr/local/bin/docker-compose

This command installs the version 1.29.2. If you wish to install a different version, please modify the VERSION mentioned in the URL or you may go to this page to find-out the latest version or you may install any other version.

Uninstalling docker-compose

sudo rm /usr/local/bin/docker-compose

Upgrading docker-compose

To uninstall docker-compose, follow the uninstall method above and then re-intsall new version.

Installing bash command completion for docker-compose

sudo curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose

The command above installs the bash command completions for version 1.29.2 of the docker-compose. If you wish to install a different version, please modify theVERSION in the URL or you may go to this page to find-out the latest version or you may install any other version.

sudo apt-get remove docker docker-engine docker.io containerd runc
		sudo apt-get update
2. Install packages to allow apt to use a repository over HTTPS:
	
	sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

3. Add Docker’s official GPG key:

	curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

	sudo apt-key fingerprint 0EBFCD88

4. Use the following command to set up the stable repository:
	
	sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

_**Please note** here that the command above might not work as per expectation in case you installed an unofficial variant of Ubuntu viz. ElementaryOS, Linux Mint etc. In those cases, please replace `$(lsb_release -cs)` with the codename of Ubuntu variant your OS was derived from._

B. INSTALL DOCKER CE

1. Update the apt package index
	
	sudo apt-get update && sudo apt-get install docker-ce

Cf. [https://docs.docker.com/install/linux/docker-ce/ubuntu/](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
docker rmi $(docker images |grep 'imagename')
docker rmi $(docker images --format ":"|findstr "imagename")
`docker inspect --format='' $CONTAINERNAME1 | sed -e 's/"//g'`

Replace the $CONTAINERNAME1 with the name of your container

More ways

What is the difference between docker-compose ports vs expose

How to understand building images with docker-compose

Multi-Stage Builds