Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the relevant knowledge of Docker?

Shulou Source: shulou.com Published: 2022-05-31 20:19:12 09月11日 Update

This article mainly explains "what is the relevant knowledge of Docker". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the relevant knowledge of Docker"?

Root permission is required for all docker operations, and sudo is required:

Docker search gitlab

Search the service image (image) and select the one marked with TRUSTED, which is relatively better.

Docker pull NAME

Download the corresponding image, due to the index.docker.io quilt wall, need a ladder, the download will be very slow.

Docker build-t NAME.

The container is built according to Dockerfile in the current directory.-- rm automatically deletes the container in the intermediate state of build.

Docker run-I-t-p 808080 NAME

Run a Container with supported parameters:

-dDetached or daemon mode, running in the background.

-I-t opens a tty terminal and maintains interactive mode, both of which are generally used together.

-e set environment variable parameters, refer to Install GitLab With Docker.

-p [host_port]: [container_port] maps the HOST port to the container to facilitate external access to the services in the container. Host_port can be omitted, which means mapping container_port to a dynamic port.

-v [host-path]: [container-path] Mount the HOST folder to Container to save data.

-- rm automatically deletes containers that are already running the same IMAGE.

Docker attach-sig-proxy=false CONTAINER

The container that attach runs in the background, plus the-sig-proxy=false parameter can be passed through Ctrl+Cdetach, otherwise once attach cannot be canceled.

Docker commit-- run='COMMAND'-m 'message' CONTAINER IMAGE:tag

Log in to the container and make some changes, log out to HOST and save the changes to the image, or send commands to the running container directly in HOST via-- run and save to the image.

Docker stop/start/restart/kill/rm CONTAINER

Stop, restart, kill, delete containers.

Docker ps-a-Q

Lists the currently running containers,-a lists all, including stopped, and-Q lists only the container ID. Docker ps-a-Q | xargs docker rm can delete all containers that are not running.

Docker logs-f CONTAINER

View the container running log.

Docker cp CONTAINER:/PATH HOSTPATH

Copy the files or folders in the container to HOST. Currently, only one-way copy from Container to HOST is supported, and HOST to Container can be copied through the insert command.

Docker insert IMAGE URL PATH

Write the contents of the URL file to the corresponding PATH. This operation does not modify the original IMAGE content, but creates a new IMAGE based on it.

Docker images

Lists the installed images. You can delete the mirror through docker rmi IMAGE.

Docker inspect CONTAINER | grep IPAddress

Check the container configuration, including internal IP and other information.

At this point, I believe you have a deeper understanding of "what is the relevant knowledge of Docker?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Container run mirror content file knowledge parameters can be passed through background command copy folder port learning support service practical deeper same two Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno NVidia vpn Shulou Information