Get started with Docker-simple commands for mirroring, containers, and warehouses

Source: Internet
Author: User
Tags port number docker ps docker run
Mirror1. Get the mirrored Docker pull dl.dockerpool.com:5000/ubuntu:14.04 (dl.dockerpool.com is the registered server, 5000 is the port number, Ubuntu is the warehouse name, 14.04 is the image is the version number ) 2. View the image information Docker images (list all mirrors that are already in the local host) change the changes information Docker tag Dl.dockerpool.com:5000/ubuntu:latest ubuntu:latest Docker Inspect 000 (000 is the image ID, which shows the details of this image) 3. Search for images docker search MySQL (output information includes image name, description, star rating, whether it was created officially, created automatically) 4. Remove mirrored Docker RMI Dl.dock Erpool.com:5000/ubuntu:latest Note: When a container created by the image exists, the image file cannot be deleted by default, so it is best to remove all containers that depend on the mirror before deleting it, and do not use force delete. 5. There are three ways to create an image: A. Create a docker commit-m "Add new Image"-a "" 000 (container ID) test (new image name) based on a container of existing mirrors

B. Import based on local template

Cat Ubuntu-14.04-x86_64-minimal.tar.gz | Docker import-ubuntu:14.04 C. Create based on Dockerfile 6. Save Image Docker Save-o Ubuntu_14.04.tar ubuntu:14.04 7. Load photographed image

Docker load--input Ubuntu_14.04.tar or

Docker Load < Ubuntu_14.04.tar 8. Upload mirrored docker push user/test:latest (user users need to register on Dockerhub website)
A container container is a running instance of a mirror, but it has an extra writable layer

1. Create a container

Docker create-it ubuntu:12.04

2. Create and start a container

Docker run-it Ubuntu:12.04/bin/bash

3. Daemon operation

Docker run-d ubuntu:12.04

4. View container Information

Docker PS [-a-q view termination status]

5. Get the container's output information

Docker logs CET (CET is the first three characters of container ID)

6. Terminating the container

Docker stop CET

7. Start the container

Docker start CET

8. Restart the container

Docker restart CET

9. Enter the container

1) Attach command

Docker attach nostalgic (nostalgic is Docker's name)

Cons: All Windows synchronized display

2) EXEC command

Docker exec-it 243 ... /bin/bash (243 ... for Docker ID)

3) Nsenter command

a) Find PID

pid=$ (Docker-pid 243..)

b) via PID link container

Nsenter--target $PID--mount--uts--ipc--net--pid

10. Delete a container

Docker RM [-f-l-V] CET

-F forcibly terminates and deletes

-L DELETE the container's link, keep the container

-V Delete Mounted data volumes

11. Exporting containers

Docker export CET >test.tar

12. Import container (Import container snapshot to local mirror library)

Cat Test.tar | Docker import-test/ubuntu:v1.0 (re-specify the name of the image labeled Ubuntu, v1.0 version number

Docker load can also import a mirrored storage file to a local mirror library, which has the advantage over import: Importing a mirrored snapshot file will lose all history and metadata information.

* * NOTE: * * Container migration (copy files) can be achieved by exporting containers and importing containers


Warehouse Warehouse is the place where the image is centrally stored, there are many warehouses on a registered server, and there are many mirrors in a warehouse. 1. Log in to Docker login

2. Basic operation

Find, Upload, download

3. Automatically create

4. View the image

Http://www.dockerpool.com/downloads

5. Update the image label

Docker tag dl.dockerpool.com:5000/ubuntu:12.04 ubuntu:12.04 (change the previous image to ubuntu:12.04)

6. Create a private warehouse

Docker run-d-P 5000:5000-v/opt/data/registry:/tmp/registry Registry (automatically download and launch registry container, create local private warehouse service, default warehouse ship container in/tmp/ registry, can be stored to the specified path via the-v parameter)

7. Managing Private Warehouse Mirroring

Assume that the private warehouse address is 10.0.2.2, the port is 5000,

Docker tag ubuntu:14.04 10.0.2.2:5000/test (change label signature)

Docker push 10.0.2.2:5000/test (push image, automatically push to 10.0.2.2 Address on the machine)

Curl Http://10.0.2.2:5000/v1/search (see if the warehouse 10.0.2.2:5000 contains a test image)

Docker pull 10.0.2.2:5000/test (download image on any machine that can access 10.0.2.2 addresses)


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.