Summary of frequently used Docker commands

#Container list
docker ps -a

#Show only running containers
docker container ls

#Show all containers
docker container ls -a

#Delete container
docker rm <CONTAINER ID>

#Image list
docker images

#Delete image
docker rmi <IMAGE ID>

#Get image
docker pull hoge

#Connect to container
docker run -it hoge bin/sh

#Stop container
docker stop <CONTAINER ID>

#Restart the container
docker restart <CONTAINER ID>

#About Docker Compose
#Run in the background
docker-compose up -d

#Stop service
docker-compose stop

#Start service
docker-compose start

#Stopping and destroying services
docker-compose down

#「--rm "option: automatically deleted when container is stopped
docker run --rm openjdk:9 java --version

#「--workdir option: specify working directory
docker run --rm --mount type=bind,src=/home/hoge/docker,dst=/home/test --workdir /home/test openjdk:9 java Hello

#About the network
#Network list
docker network ls

#Create a network
docker network create hoge

#Join the container to the created network
docker run --name nginx --network=hoge -d nginx

#Check network
docker network inspect hoge

#Delete network
docker network rm hoge

#About Volume
#Volume list
docker volume ls

#Volume details
docker volume inspect <Volume ID>

#Update container and commit to image
docker run -t -i hoge /bin/bash  #Connect to container
gem install json                 #Change container
docker commit -m "Added json gem" -a "Kate Smith" \
<Container ID> <image ID>:tag    #Create an image based on the modified container



Recommended Posts

Summary of frequently used Docker commands
Summary of frequently used commands in Rails and Docker
Docker Frequently used commands
Introduction to Docker (1) Frequently used commands
Frequently used functions and commands of Xcode
[Github] Summary of commands often used during development
git flow Frequently used commands Memo
A collection of commands that were frequently used on heroku
[Docker] Other frequently used (probably) Docker Instructions
Summary of Docker commands that I often use but can't remember
Summary of Docker understanding by beginners ② ~ docker-compose ~
[Rails Struggle/Rails Tutorial] Summary of Heroku commands
[EMMET notation] Basic, frequently used guy Emmet notation summary
Introduction of Docker Hub and commands Self-learning ①
Java Summary of frequently searched type conversions
Docker basic summary
Docker basic commands
[Memo] docker summary
Docker command summary
[Docker] Command summary
[Docker] Introduction to docker compose Basic summary of docker-compose.yml
Summary of Docker understanding by beginners ① ~ docker run -p ~
A collection of RSpecs that I used frequently
Introduction of Docker --Part 1--
Docker terms and commands
Frequently used docker-compose command
Summary of OpenJDK sources
Summary of strong parameters
Frequently used Java generics
Summary of jar files
Summary of information security
Summary of using FragmentArgs
Personal summary of the guys often used in JUnit 4
List of frequently used Java instructions (for beginners and beginners)
docker command personal summary
Summary of using DBFlow
Summary of Java support 2018
I'll forget to look it up, so I've put together a list of frequently used Docker commands [updated from time to time]
A concise summary of Java 8 date / time APIs that are likely to be used frequently
List of Docker commands that I often use (container operation)
Summary of css selectors that can be used with Nookogiri
[Memo] Commands used when using Docker (stop container, delete, delete image)
[Summary of technical books] Summary of reading "Learn Docker from the basics"
Overview of Docker and containers
Docker monitoring-explaining the basics of basics-
Summary of FileInputStream and BufferedInputStream
Docker Compose basics and commands
[Java11] Stream Summary -Advantages of Stream-
About simple operation of Docker
Summary of using Butter Knife
IntelliJ Frequently Used Operation Notes
Understand the basics of docker
I've only heard of Docker ...
[Java] Summary of regular expressions
Frequently used processes in SpreadSheet
Summary of "abstract interface differences"
Summary of Java language basics
[Java] Summary of for statements
Summary of Java Math class
[Ruby] List of basic commands
rails console Frequently used operations