Docker Common Commands

Source: Internet
Author: User
Tags docker ps

Docker boot file

/usr/lib/systemd/system/docker.service


Installing Docker

Yum Install Docker


Start Docker

Systemctl Start Docker


Modify the Docker configuration file

Vi/etc/sysconfig/docker


Add parameters to options (new version 7 Docker is not available)

--storage-opt dm.basesize=100g Single docker file system size limit 100G (default 10G)

--storage-opt dm.loopdatasize=200g Total File size 200G (default 100G)


The modified parameters are

Options= '--selinux-enabled--storage-opt dm.basesize=50g--storage-opt dm.loopdatasize=100g '


Stop Docker

Systemctl Stop Docker


Delete Docker data

rm-rf/var/lib/docker/*


Reload Configuration

Systemctl Daemon-reload


Start Docker

Systemctl Start Docker


View Docker Information

Docker info

Data Space total:214.7 GB

Greater than 200G modification succeeded


Import docker files and generate a docker image named ImageName with version number V1

Docker Import-imagename:v1 < Import.tar


View image

Docker images


Executes an image and generates a container

image_id Please use Docker images to view


-P binding Port 8888,80,8025

-V Mount the host directory/home/docker-mount to the Docker virtual machine directory/root/docker-mount

-e Set the time zone for the Docker virtual machine to Asia/shanghai

Optional parameter--privileged=true, if the Mount directory does not have permissions, add this parameter


Docker run--privileged=true-i-t-p 8888:8888-p 8025:8025-p 80:80-v/home/docker-mount:/root/docker-mount-e "TZ=Asia /shanghai "Be13645531d7/bin/bash


Docker run--privileged=true-i-t-p 8888:8888-v/root/docker-mount:/root/docker-mount-e "Tz=asia/shanghai" 5e6fb2633d 92/bin/bash


Docker run--privileged=true-i-t-p 80:8080-v/root/docker-mount:/root/docker-mount-e "Tz=asia/shanghai" Images_id/bi N/bash


-------------------------------------------------------------Other Commands-------------------------------------------------------- ---


Delete Docker image

Docker RMI image_id


View in-run container

Docker PS

-a optional parameter A to view all container, including the stop status


Start a stopped container

Docker start container_id


Stop a container that has started

Docker Stop container_id


Enter container

Docker Attach container_id


Exit container, and stop container

Exit

is equivalent to performing Docker stop container_id outside of CONTAINER


Exit container, do not stop container

Ctrl+p and Ctrl+q


Export container to a file

Docker Export container_id > Xxx.tar


Delete Container

Docker RM container_id


View Docker's virtual IP address

Docker Inspect 220b038bd54a|grep IPAddress


Docker common Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.