Welcome to Jetson Orin NANO Developer Kit repository
03.Docker command
Docker Commands
Docker Commands1. View Detailed Information2. View the Version Number3. Pull the Image4. Run the Container4.1. View the Running Containers4.2. View All Containers (Including Stopped Containers)5. Clean Up Stopped Containers6. View Local Images7. Delete Images8. Commit the Image9. Stop the Container10. Multiple Terminals Entering the Same Container
The Docker engine includes Docker CLI, which provides command-line tools for interacting with the Docker daemon. This tutorial introduces the usage of 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 is 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 does not exist locally, docker pulls the corresponding image automatically.
docker run <image_name>
xxxxxxxxxxdocker run hello-world
docker run <image_name>:
Run the container once and let it exit:
xxxxxxxxxxdocker run ubuntu:18.04
Run the container interactively; type exit to exit
xxxxxxxxxxdocker run -it ubuntu:18.04 /bin/bash

4.1. View the Running Containers
docker ps
xxxxxxxxxxdocker ps
4.2. View All Containers (Including Stopped Containers)
xxxxxxxxxxdocker ps -a

5. Clean Up Stopped Containers
This command deletes all stopped containers on the local machine and does not delete images. Before executing it, confirm that these containers contain no data that needs to be retained; Docker asks for confirmation again during execution.
docker container prune
xxxxxxxxxxdocker container prune

6. View Local Images
docker images
xxxxxxxxxxdocker images

7. Delete Images
Note: If a container is still using this image, stop and delete that container first; only then can the image be removed.
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 it;
If the container is closed 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 Entering the Same Container
Containers are isolated from each other. Each execution of docker run creates and starts a new container; to perform operations in the same container, 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 container:
xxxxxxxxxxdocker ps
docker exec
Enter the running container in interactive mode: modify according to the actual CONTAINER ID
xxxxxxxxxxdocker exec -it bc4fcf3ef267 /bin/bash
