Install yum install Docker-Ioyum Upgrade Device-mapper-libsservice Docker Startdocker pull CentOS//Pull the CentOS image, it seems that the east of the network is very poor to wait some time to download the endToday: Write the payment interface document; C=>linux Core Programming =>linux Network programming =>c++peimer=>efftcive STL View version: Docker-v View Help information: Docker search for images in the official warehouse: Docker search CentOS View local Image: Docker images download warehouse image to Local: Docker pull Centos:latest Upload local image to warehouse: Docker push Name[:tag] Save image as tar file: Docker save-O tar file mirroring ID/Mirror Tag loads the tar file as a mirror: Docker load-I tar file modified mirror tag:docker tag Image ID Mirror tag delete image: Docker rmi image ID/Mirror Tag make Image: Docker build-T CENTOS:AUTOSSHD-<dockerfile.txt View image history: Docker Historical Image ID/Image Tag Creation container: Docker run-D--name= container name mirroring ID/Mirror tag d means running in the background--name equivalent to the MySQL syntax asFor example, Docker run--name centosrongqi-i-T centos/bin/Bash-I: Open the stdin in the container-T: Assigning a pseudo-TTY terminal boot container to a container: Docker start container name/container ID View container: Docker PS-a indicates which containers have been run Docker commit-M"Description"-A"Saymagic"79C761F627F3 saymagic/ubuntu-Nginx:v1-A can specify RPM for user information-Q centos-release CentOS-release-5-4. El5.centos.1Restart container: Docker restart container name/Container ID Stop container: Docker stop container name/Container ID Delete container: Docker RM container name/container ID Pause container: Docker Pause container name/Container ID Recovery container: Docker unpause container name/container ID execution command: Docker exec-ti container name/container id/bin/bash get container log: Docker logs container name/container ID operations on image (search, pull, images, RMI, history# search Image$docker search image_name# download Image$docker pull image_name# Lists the image list; -A,--all=falseShow all images; --no-trunc=falseDon't truncate output;-Q,--quiet=false only show numeric IDs$docker images# Delete one or more mirrors;-F,--force=falseForce; --no-prune=falseDo not delete untagged parents$docker rmi image_name# shows the history of a mirror;--no-trunc=falseDon't truncate output;-Q,--quiet=false only show numeric IDs$docker History image_name start container (run) # runs in a container"Echo"command, output"Hello Word"$docker run image_name Echo"Hello Word"# Interactive entry into the container $docker run-i-t image_name/bin/bash# Installing a new program in the container $docker run image_name apt-GetInstall-y app_name View Container (PS) # Lists all currently running Container$docker ps# list all container$docker PS-a# List The most recently launched Container$docker PS-L Save changes to the container (commit) # Save the changes to the container;-A,--author=""Author; -M,--message=""commit Message$docker commit ID new_image_name6Operations on Containers (RM, stop, start, Kill, logs, diff, top, CP, restart, attach) # Remove all containers $docker rm ' Docker PS-A-Q ' # delete a single container;-F,--force=false; -L,--link=falseRemove the specified link and not the underlying container; -V,--volumes=falseRemove The volumes associated to the Container$docker RM Name/id# Stop, start, kill a container $docker stop Name/id$docker start Name/Id$docker Kill Name/id# log from a container;-F,--follow=falseFollow log output; -T,--timestamps=falseShow timestamps$docker Logs Name/id# lists the changed files or directories in a container, the list will show three events, a added, D deleted, C changed $docker diff Name/id# Displays the process information inside a running container $docker top Name/id# copying files from inside the container/directory to a local path $docker CP Name:/Container_path to_path$docker cp ID:/Container_path to_path# Restart a running container;-T,--time=TenNumber of seconds toTryTo stop forBefore killing the container, default=Ten$docker Restart Name/The id# is attached to a running container;--no-stdin=falseDo not attach stdin; --sig-proxy=trueproxify all received signal to the Process$docker Attach Idnote:attach command allows you to view or affect a running container. You can attach the same container at the same time. You can also detach from a container, from the CTRL-C. 7Save and load images (save, load) when you need to migrate a mirror on one machine to another machine, you need to save the image and load the image. # Save the image to a tar package; -O,--output=""Write to an file$docker save Image_name-o file_path# load a tar package in the format of the image;-I.,--input=""Read froma tar archive file$docker load-i file_path# machine a$docker save Image_name>/home/save.tar# Use SCP to copy the Save.tar to machine B, then: $docker loadSave.tar8, login Registry Server (login) # Login to registry server;-E,--email=""Email; -P,--password=""Password; -U,--username=""Username$docker Login9. Publish image (push) # Publish Docker image $docker push New_image_nameTen. Build a container based on the Dockerfile #build--no-cache=falseDo not use cache when building the image-Q,--quiet=falsesuppress the verbose output generated by the containers--rm=trueRemove Intermediate Containers after a successful build-T,--tag=""Repository name (and optionally a tag) to being applied to the resulting imageinch Caseof Success$docker Build-T image_name dockerfile_pat which<>the width of the parameter is required, [] wide up for the optional Docker version to view the release number of Docker, including client, server, dependent go and other Docker info viewing system (Docker) level information, including management of the images, Containers number and other Docker search<image>search for Imagedocker pull in Docker index<image>drop Imagedocker Push from Docker registry server<image|repository>push an image or repository to Registrydocker push<image|repository>: TAG Ibid., designation Tagdocker Inspect<image|container>View the underlying information for an image or container docker images TODO filter outthe intermediate image layers (intermediate image layers) Docker images-a list all Imagesdocker PS default display is running Containerdocker PS-L display the last created container, including the non-running Docker PS-a displays all container, including the non-running Docker logs<container>View container's logs, which are some output of the Execute command Docker RM<container...>Delete one or more containerdocker rm ' Docker PS-A-Q ' Remove all Containerdocker PS-a-q |Xargs Docker rm Ibid, delete all Containerdocker rmi<image...>Delete one or more imagedocker start/stop/restart <container> Open/Stop/Restart containerdocker Start-I <container>Start a container and enter interactive mode Docker attach<container>attach a running Containerdocker run<image> <command>use image to create a container and execute the appropriate command, and then stop the Docker run-i-t <image>/bin/bash use image to create container and enter interactive mode, the login shell is/bin/Bashdocker Run-I-T-P map the port of container to a host's port such as Docker run-d-pBayi: thecentos-nginx/usr/local/openresty/nginx/sbin/Nginx Docker Run-d-p192.168.9.11:2201: ANGINX/CENTOS/USR/SBIN/SSHD-D with SSH [email protected]192.168.9.11-P2201connecting containers, Tip: Connection to192.168.1.205Closed. (This issue has not been resolved!!!) Docker commit<container>[Repo:tag] solid a container into a new image, followed by the Repo:tag optional Docker build<path>look for a configuration file named Dockerfile under path Path, using this configuration to generate a new Imagedocker build-T Repo[:tag] Ibid, you can specify repo and optional Tagdocker build-< <dockerfile>using the specified dockerfile configuration file, Docker obtains the content stdin, using this configuration to generate a new Imagedocker port<container> <container port> See which port on the local map to the specified port of container, in fact, with Docker PS can also see
Linux--docker Study Notes