banner
Geek

Geek

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

How to install Docker & Compose for beginners

1. 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

Display Docker version#

docker -v

Enable Docker to start on boot#

systemctl enable docker

2. Install Docker-Compose#

Check the latest version of Compose#

Tags · docker/compose (github.com)

Replace download/v2.17.3/docker-compose with the latest version

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

Display Compose version#

docker-compose --version

Uninstall Docker#

sudo apt-get purge docker-ce docker-ce-cli containerd.io
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.