First, the use of mirror

1. View the mirror
docker images
Copy the code

Description of each option:

  • **REPOSITORY: ** represents the REPOSITORY source of the image

  • **TAG: ** image TAG

  • **IMAGE ID: **IMAGE ID

  • **CREATED: ** Image creation time

  • **SIZE: ** Mirror SIZE

2. Start the image
docker run -it ubuntu /bin/bash
Copy the code
3. Obtain the image
docker pull ubuntu
Copy the code
4. Find the mirror
docker search mysql
Copy the code
5. Delete the mirror
docker rmi mysql
Copy the code
6. Update the image

Into the container

docker exec -it jdk8 /bin/bash
Copy the code

Run the following command to update the image

apt-get update
Copy the code

Two, container use

1. Start the container
docker run -it ubuntu /bin/bash
Copy the code

Parameter Description:

  • -i: interactive operation.

  • – t: terminal.

  • Ubuntu: Indicates an Ubuntu image.

  • /bin/bash: After the image name is the command. Here we want an interactive Shell, so /bin/bash is used.

2. Enter the container

Enter container, exit container stop

docker attach
Copy the code

Recommended. Entering the container, exiting does not stop the container

docker exec
Copy the code

Start and enter the container

docker run -it ubuntu /bin/bash
Copy the code

Start the stopped container

Docker start < container ID>Copy the code

Run in the background. -d specifies the container running mode

docker run -itd --name ubuntu-test ubuntu /bin/bash
Copy the code
3. Exit the container
exit
Copy the code
4. Stop the container
Docker stop < container ID>Copy the code
5. Delete the container
Docker rm -f < container ID>Copy the code
6. Look at containers
docker ps
Copy the code