docker data management

Create a method docker mirror

There are three ways to create a mirror, namely the existing image creation, and creation based on local docker create a template based.
Based on the existing image creation
created primarily docker commit command based on existing images,
commonly used options:
-m: Information Description
-a: Author Information
-p: Stop the build process container run
command format
docker commit [Options] container id / name warehouse name: [label]
docker data management
local template created based
can generate images, a template can be downloaded from OPENVZ open source operating system project by importing the template file available for download at http://openvz.org/Download/template/precreated
introduce compressed template download ubuntu package, using the docker import command to import a local mirroring
docker data management
docker data management
based dockerfile create
dockerfile structure roughly divided into four parts: the base image information, when the instruction execution maintainer information, instructions and image container starts.
# Centos import a container in advance
docker data management
1. Create a working directory
docker data management
2. Create a file and write dockerfile
docker data management
3. Write a script to perform content
docker data management
4. Create a test page
docker data management
5. Use dockerfile generated image
after completing the preparation dockerfile and related content can be created by docker build command mirror
command format
docker build [option] path
common option
-t specified image tag information
docker data management
# The last point represents the current path.
6. Use the new image to run container
-p 12345: 80 meant to map the local port 80 to port 12345
docker data management
last used Web access to test
docker data management

Guess you like

Origin blog.51cto.com/14243230/2465349