Docker practice quick start

1. Install docker
 * Install on CentOS7: yum install -y docker
 * Install on CentOS6:
   wget http://mirrors.hustunique.com/epel/6/x86_64/epel-release-6-8.noarch.rpm && rpm -ivh epel-release-6-8.noarch.rpm
   yum install -y docker-io


 * Install on Windows:
   download boot2docker, after installation, click "Boot2Docker Start" on the desktop.


2. Configure docker to
 change the working directory of Docker:
  # vim /etc/sysconfig/docker
  OPTIONS=--selinux-enabled -H fd:// -g="/data/docker"
  # Note: Restart the docker service after modifying the configuration file It took effect. -g="/data/docker" is to change the default root path of Docker from /var/lib/docker to /data/docker, for example, all Docker images will be placed in this directory.

3. Start the docker service
  chkconfig docker on
  service docker start


4. Download the docker image
  docker pull centos:centos7
  View existing images: docker images


5. Create image from Dockerfile
  # mkdir docker_file && cd docker_file
  # touch Dockerfile
  # echo "FROM centos:centos7"> Dockerfile
  # echo "RUN yum install -y golang" >> Dockerfile
  # 
  # docker build -t gogogo.
  # Note: docker build will recursively find all Dockerfile files in the directory.


6. Test docker images
  # docker run gogogo rpm -q golang


7. Docker related management tools
  kubernetes: https://github. com/GoogleCloudPlatform/kubernetes/
  fig: https://github.com/docker/fig
  Openstack
  etcd: https://github.com/coreos/etcd

Guess you like

Origin blog.csdn.net/huzhenwei/article/details/43406779