我要评分
获取效率
正确性
完整性
易理解

Common Commands

Table 1 Common Docker commands

Command

Description

docker run --network host

Enables the containers and hosts to share the network.

docker pull ubuntu:17.10

Pulls the 17.10 image.

docker run -p 15555-15579:15555-15579

Maps a range of ports (host:guest).

docker port container

Displays configuration of the mapped ports.

docker inspect container

Displays the underlying information about a container.

docker info

Displays container configuration.

docker ps (-a)

Displays the container list.

docker images

Displays container images.

docker run -v /root/data/:/home/data/

Maps the /root/data directory on the host to the /home/data directory in the container for data transmission.

docker commit 812a997f614a(container id) ubuntu:update(image name:tag)

Saves the modified image as a new image.

docker export cbe3cb7799ed(container id) > update.tar

Exports image data based on a container.

docker import - update < update.tar

Imports an image.

docker save ***** (image id) >ubuntu_17.10.tar

Saves an image as a local file.

docker load < ubuntu_17.10.tar

docker tag ***** (image id) Ubuntu:17.10

Loads a locally packaged image file to the container engine.

docker cp HOST_PATH <CONTAINER-NAME>:/PATH

Copies files to a container.

docker run -it -d -p 5900:5900 -p 15555-15577:15555-15577 --name mesa0 --privileged -v /root/share:/root/share ubuntu:17.10 /bin/bash

Starts Docker (example).