apt-get update
apt-get install -y docker.io
curl -s https://get.docker.com|sh
ps: Download the docker installation webpage to the local and execute sh
docker version
docker pull [OPTIONS] NAME[:TAG]
NAME: Mirror name (can be queried in the official docker warehouse or NetEase Hive Center)
[ OPTIONS]: command options
[ TAG]: version, the default is the latest
docker images [OPTIONS] [REPOSITORY[:TAG]]
[ REPOSITORY]: Specify the name of the mirror (usually used when there are many local mirrors)
docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
IMAGE: image name
[ COMMAND]: Run command
[ ARG]: The parameters that this command depends on
d: running in the background
p: Specify which port of the machine to map the port of the container
P: randomly assign a local port to map all ports of the container
For example, run nginx in the background and specify the local port 8080 to map the default port 80 of nginx: docker run -d -p 8080:80 nginx
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
CONTAINER: container name or container ID
i: Ensure that the input is valid
t: Assign a pseudo terminal
Such as: docker exec -it CONTAINER bash
exit
docker stop CONTAINER
CONTAINER: Container ID
docker build -t .
. : Indicates to build the directory and Dockerfile in the current directory
docker rm IMAGEID
docker rmi CONTAINERID
If the image is already running as a container, you must delete the container first to delete the image. To delete a container, stop the container first
Please refer to my other blog: https://www.cnblogs.com/javafucker/p/9871332.html
Docker is developed by ubuntu, so it must be the most stable when running on ubuntu
Official docker warehouse: https://hub.docker.com/
Recommended Posts