[Linux]-docker configures containers and packages them into images

View local mirror:

The relationship between containers and images: containers are objects, images are classes, and one image can have multiple containers.
Insert image description here

docker commit container id new image name: version number
run container:

docker run -i -t ubuntu /bin/bash
docker exec -it -u root zwbase /bin/bash

docker exec -it will connect to the container. You can enter the container like SSH and perform operations. You can exit the container through exit without affecting the running of the container.
Insert image description here

Anaconda environment activation/deactivation

source activate/deactivate

Insert image description here

Package the container into an image:
Option function
-a Specify the new image author
-c Use Dockerfile Instructions to create the image
-m Submit the instructions for generating the image
-p Pause the container when committing
docker commit -a “tom” -m “create sanic img” ed54ac3a09ac sanic:v1

Package the image into a tar file:
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here

 docker cp NVIDIA-Linux-x86_64-535.54.03.run  zwbase:/root
 
docker exec -it -u root zwbase /bin/bash

Guess you like

Origin blog.csdn.net/qq_44859533/article/details/134019364