Docker command super abbreviated version

We have summarized the minimum commands from terminal to container creation to dockerhub repository creation.

Image creation

docker build -t --force-rm=true (Image name):(tag) .

--force-rm: Delete image if build fails

Container creation + start

/ bin / bach can be changed to any execution command

docker run --runtime=nvidia --rm -v (Mount directory):(Directory name in the container)\\
--name (Container name) -it (Image name) /bin/bash

--runtime = nvidia: Runtime specification (probably changed as of 2020) --rm: Delete container at the end of execution -v: Share the host OS directory with the Docker container

Creating a repository for uploading to docker hub

docker commit (Container name) (Repository name):(tag)

Upload to docker hub

docker login #You will be prompted for a username and password
docker push (Repository name):(tag)

(Bonus) Docker operation

docker images -a #Image list
docker rmi (Image ID) #Image deletion
docker ps -a #Container list
docker rm (Container ID) #Delete container
docker start -i (Container ID) #Container startup

-a: Show unused images and containers

Recommended Posts

Docker command super abbreviated version
Git command super abbreviated version
Django + Docker command
Docker command summary
CentOS version confirmation command
[Super basic] Docker command procedure manual when using Ubuntu on Mac
Completion of docker command on Linux
Command list such as Docker / Kubernetes