banner
Geek

Geek

🧠在家居士 | 🥦素食者 | 🏃🏻马拉松爱好者 | 📡AI降临派 | 过🪜技术资深学者 | 🤖科技狂 | 📤更新狂🆅 https://www.igeekbb.com/
twitter
github

How to install Docker & Compose for beginners

Install Docker

Using Debian as an example

Update packages and install wget and vim tools

apt-get update && apt-get install -y wget vim

Download and install Docker

wget -qO- get.docker.com | bash

Show Docker version

docker -v

Enable Docker to start on boot

systemctl enable docker

Install Docker-Compose

Check the latest version of Compose

Tags · docker/compose (github.com)

Replace <span style="color:red">v2.17.3</span> with the desired version number in the following command:

sudo curl -L "https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Make it executable

sudo chmod +x /usr/local/bin/docker-compose

Show Compose version

docker-compose --version

Uninstall Docker

sudo apt-get purge docker-ce docker-ce-cli containerd.io

Remove Docker files

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Common Docker commands

CommandDescription
docker runRun a container
docker buildBuild an image
docker pullPull an image
docker pushPush an image to a repository
docker imagesList all local images
docker psList running containers
docker stopStop one or more containers
docker rmRemove one or more containers
docker rmiRemove one or more images
docker execExecute a command in a container
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.