Docker Useful Commands
This part contains a collection of basic and useful Docker commands in daily using. A full list of Docker commands can be found at here. For the Docker commands for NVIDIA DGX Cloud Service usage can be found at 1 and 2.
Some common use commands are listed below:
1. List images on the system
It will return the Docker images on the system (below is an example):
2. List running containers
It will return the Docker containers running by all users now on the system (below is an example):
The CONTAINER ID
can be used to identify your container in other commands.
3. Run a container
4. Exit a container
Exit a container and close it, then container cannot be found via docker ps
:
Exit a container without closing it, container can be found via docker ps
:
5. Resume a container
To resume a container after exiting with “ctrl+P+Q”:
or
Using the second one will sometimes get stuck and have no response for a long time. The first one is preferred.
6. Kill a container
7. Save a customized container
Sometimes if you have done some changes (e.g. install new packages or drivers) in a container, it is better to save the modified container as a new container image before exiting it. Then next time you can directly run your saved image to resume the container environment.
The repository
and tag
are your customized ones for the next time using.
8. Upload a customized container to NGC
Sometimes a customized container image is built and saved on one HPC, and you want to use the image on another machine. Then it is better to upload the customized container image to our group's cloud space in NGC. Then the image can be pulled from our cloud space on the other machine.
Please contact szhang4@gradcenter.cuny.edu if you want to do so.
Last updated