1. Concept:
An open source application container engine that packages developers ’applications and dependencies in a portable container, equivalent to a sandbox.
Docker allows developers to isolate and run multiple applications on a single operating system instead of dedicating a virtual machine to each application on the server.
This is achieved by isolating applications in separate containers. Although these applications are separated by the container, they can share the operating system and other resources.
Advantages: The use of containers is more lightweight, can reduce costs, better use of resources and play a higher performance.
2. Composition:
Docker is mainly composed of clients, daemons, images, and containers.
Three. Dockerfile writing
FROM python: v3. 6 #Load base image maintainer name, mail # created, name, mailbox COPY. /Requirements.txt / root / requirements.txt # Copy local files to the mirror WORKDIR / root # Configure the path CMD [ " / bin / python " , " /app.py " , " run " ] #Start the main program
Four, common docker commands
Find mirror docker search ouruser/sinatra Pull image to local docker pull ouruser/sinatra:v2 Create mirror docker build -t ouruser/sinatra:v2 . The specified port is started by default docker run -d -p 10022:22 -p 5000:5000 9237f60b18d0 Specify the port bash to start docker run -t -i -p 10022:22 -p 5000:5000 9237f60b18d0 /bin/bash Specify the container name to start docker run -it -d --name c847084bed94 -p 5001:5001 -p 5055:5055 zhongzh/demo Automatic restart, the maximum number is 10 docker run --restart=on-failure:10 redis Move files inside and outside the container docker cp filename zhongzh@host_ip:/home/ Enter container view sudo docker exec -it 3c6b44cbcc8f /bin/bash Stop / start container docker stop/start 3c6b44cbcc8f View mirror docker images View currently running containers docker ps Submit Modified Container docker commit 9237f60b18d0 demo:v1.0
Fifth, the actual experience of docker
1. Simplified the environment configuration of deep learning
2. Various deployment environments are based on fools
3. Reusable and portable