标签:
wget -qo- https://get.docker.com/ | sh
sudo docker run hello-world
sudo usermod -aG docker johnnytu
docker run hello-world
Install Docker
sudo docker version
Docker Machine
Tools that provisions Docker hosts and installs the Docker Engine on them
Docker Swarm
Tools that clusters many Engines and schedules containers
Docker Compose
Tools to create and manage multi-container applications
Create a Docker Hub Account
Display local image
sudo docker images
Creating a Container
sudo docker run [options] [image] [command] [args]
image is specified with repository:tag
Examples
docker run ubuntu:14.04 echo “hello world”
docker run ubuntu ps ax
docker run -i -t ubuntu:14.04 /bin/bash
The -i flag tells docker to connect to STDIN on the container
The -t flag specifies to get a pseudo-terminal
Run a Container and get Terminal Access
Ctrl + P + Q
Container ID
Containers can be specified using their ID or name
Long ID and short ID
Short ID and name can be obtained using docker ps command to list containers
Long ID obtained by inspecting a container
Running in Detached Mode
Also known as running in the background or as a daemon
Use -d flag
To observe output use docker logs <container id>
docker run -d centos:7 ping 127.0.0.1 -c 50
List Your Containers
A More Practical Container
Run a web application inside a container
The -P flag to map container ports to host ports
Create a container using the tomcat image, run in detached mode and map the tomcat ports to the host port: docker run -d -P tomcat:7
Run a Web Application Container
Self-Paced Training (1) - Introduction to Docker
标签:
原文地址:http://www.cnblogs.com/thlzhf/p/5324950.html