Welcome to Jetson Orin NX Developer Kit repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
03.Docker command
Docker command
Docker command1. View detailed information2. View the version number3. Pull the image4. Run the container4.1. View the running containers4.2. View all containers (including the stopped ones)5. Clean up the stopped containers6. View the local images7. Delete the image8. Commit the image9. Stop the container10. Multiple terminals enter the same container
The Docker Engine includes the Docker CLI, which provides a command-line tool to interact with the Docker daemon. This tutorial introduces the usage of the common Docker commands.
1. View detailed information
docker info
docker info

2. View the version number
docker --version
xxxxxxxxxxdocker --version

3. Pull the image
docker pull <image_name>
If no tag is specified, the image with the latest tag will be pulled by default.
xxxxxxxxxxdocker pull hello-world
docker pull <image_name>:
xxxxxxxxxxdocker pull ubuntu:18.04

4. Run the container
If the image to be run is not available locally, docker will automatically pull the corresponding image.
docker run <image_name>
xxxxxxxxxxdocker run hello-world
docker run <image_name>:
Start the specified container and exit:
xxxxxxxxxxdocker run ubuntu:18.04
Start the specified container in interactive mode: enter exit to quit
xxxxxxxxxxdocker run -it ubuntu:18.04 /bin/bash

4.1. View the running containers
docker ps
xxxxxxxxxxdocker ps
4.2. View all containers (including the stopped ones)
xxxxxxxxxxdocker ps -a

5. Clean up the stopped containers
This command deletes all the stopped containers on the local machine, but it does not delete images. Before running it, make sure that none of these containers holds data you need to keep; Docker will ask for confirmation again when it runs.
docker container prune
xxxxxxxxxxdocker container prune

6. View the local images
docker images
xxxxxxxxxxdocker images

7. Delete the image
Note: If a container is still using the image, you need to stop and remove the corresponding container first, and only then can the image be deleted.
docker rmi <image_name>
xxxxxxxxxxdocker rmi hello-world
docker rmi <image_name>:
xxxxxxxxxxdocker rmi ubuntu:18.04

8. Commit the image
Pull and run the ubuntu:18.04 image in interactive mode
xxxxxxxxxxdocker run -it ubuntu:18.04 /bin/bash
docker commit
<image_name>:
Note: Modify according to the actual CONTAINER ID
xxxxxxxxxxdocker commit 2efca1aa1bb1 ubuntu_18.04:1.0.0

9. Stop the container
If the container is run in interactive mode and the terminal has entered the container, you can enter exit inside the container to stop the container;
If you close the container from the outside, you can use the docker stop command.
docker stop
Note: Modify according to the actual CONTAINER ID
xxxxxxxxxxdocker stop 2efca1aa1bb1

10. Multiple terminals enter the same container
Containers are isolated from each other. Every time docker run is executed, a new container is created and started; if you need to perform operations in the same container, you should use docker exec to enter that container.
Start a container based on the ubuntu:18.04 image in interactive mode:
xxxxxxxxxxdocker run -it ubuntu:18.04 /bin/bash
View the running containers:
xxxxxxxxxxdocker ps
docker exec
Enter the running container in interactive mode: modify according to the actual CONTAINER ID
xxxxxxxxxxdocker exec -it bc4fcf3ef267 /bin/bash
