Advantages and Disadvantages of Containers
Docker image: A read-only template containing all the necessary files, libraries, and dependencies required to run an application in a Docker container
Docker container: A running instance of an image. That is, an executable package including the code, libraries, and dependencies needed to run the application
Dockerfile: A script containing instructions to create the image you should use root account or sudo plus some docker commands to run these command lines.
Display Docker version
docker --version
Display Docker system info
docker info
Get help on Docker
docker --help
Run a container
It should use docker run {container name}
, currently I want to use hello-world
as container name.
docker run hello-world
List all running containers
docker ps
List all containers
docker ps --all
Pull an image from a registry with docker pull {image}
docker pull ubuntu
docker start --interactive --attach ubuntu
this command is used to start an existing Docker container in an interactive mode and attach your terminal’s standard input, output, and error streams to the container.
Stop a container with docker stop {container ID}
docker stop {container ID}
Kill and remove a container
docker rm --force {container ID}