Here are some of the basic Docker commands, syntax and what they are used for. We will go into depth concerning options and arguments in a separate article.
Show the current version of docker that you are running:
docker - version
docker -version [OPTIONS]
Pull an image from a repository:
docker pull
docker pull [OPTIONS] NAME[: TAG|@DIGEST]
Create a container based on the specified image:
docker run
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
List all of your current containers:
docker ls
docker ps [OPTIONS]
Run a command in a currently running container:
docker exec
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Start a stopped container:
docker start
docker start [OPTIONS] CONTAINER [CONTAINER...]
Stop a running container:
docker stop
docker stop [OPTIONS] CONTAINER [CONTAINER...]
Restart a running container:
docker restart
docker restart [OPTIONS] CONTAINER [CONTAINER...]
Kill a running container:
docker kill
docker kill [OPTIONS] CONTAINER [CONTAINER...]
Rename a container:
docker rename
docker rename CONTAINER NEW_NAME
💡
More info and commands can be found on the official Docker website.
Top comments (0)