docker container docker container

docker container

 

      The container is a docker core concept of 2477203708, the container is a running instance mirror. Mirroring only static read-only file, but when the vessel is required to run with writable files, application process container is running.

Simple to understand a container that contains a program we run, we need to understand how to operate the vessel, only proper maintenance of the application of our container. docker provides a number of commands, users can efficiently manage the entire life cycle of the container.

  • Create a container
    • New Container
      • Create a simple container, said simply complicated and very complex, he has many options, including the mode of operation of container, container environment configuration, security, resource constraints and container container and so on. . , Or take some time to master, the following is simply called by a mirror ubuntu, the label for the latest mirroring, create a container.
      • docker create -it ubuntu:latest
    • Start container
      • After you create a container, we adopted the following command to start up the container.
      • docker start 182ead1dfa60
    • New and launch container
      • We can use the following command to create and direct start.
      • docker run ubuntu:latest 
    • The guardian of the state run
      • Create a container plus -d container, in order to protect state run in the background.
      • docker run  -d ubuntu:latest
    • View content output
      • Obtaining container output
      • docker logs 182ead1dfa60
  • Stop the container
    • Suspended container
      • Start container docker start 182ead1dfa60
      • Pause container docker pause testcon
      • View container paused
      • Suspended container may restart command to restart the container docker restart 182ead1dfa60 
    • Termination container
      • docker stop 182ead1dfa60
      • The container can be used in a termination state id container docker start to start.
  • Into the container
    • attach command
      • If you create a boot container using the -d parameter, the vessel will start into the background, so enter the vessel through the attach command, you can view or operation of the internal container.
      • Examples: docker attach c071248c8388
    • exec command
      • It is relatively attach more convenient. Can execute arbitrary commands directly in the operation of the vessel, the further we can do other operations
      • docker exec -it c071248c8388 /bin/bash
  • Delete container
    • It can be deleted after can be deleted by the Delete command in the termination of the state or states to exit the container, if the container is running is not deleted, it needs to stop.
    • If you want to forcibly remove the container running command with the -f can.
    • docker rm -f c071248c8388
    • docker rm c071248c8388
  • Export Import Container
    • Export Container
      • Sometimes we need a container to migrate from this server to another server, we can export the container.
      • docker export -o test.tar testcon
    • Import Container
      • docker import test.tar - test/ubuntu:v1.0
  • View container
    • View container details
      • You can view the container-specific information, including the id of the container, creation time, status, etc.
      • docker container inspect testcon
    • View container process
      • View container process information
      • docker top testcon
    • View statistics
      • Displays the contents of cpu usage and other network information
      • docker stats testcon
  • other
    • Copy files
      • Docker can copy files between the host provides a command vessel
      • docker cp data test : /tmp/
    • Change View
      • docker container diff testcon
    • View port mapping
      • docker container port testcon
    • Update Configuration
      • docker update testcon  [CONTAINER...]

      The container is a docker core concept of 2477203708, the container is a running instance mirror. Mirroring only static read-only file, but when the vessel is required to run with writable files, application process container is running.

Simple to understand a container that contains a program we run, we need to understand how to operate the vessel, only proper maintenance of the application of our container. docker provides a number of commands, users can efficiently manage the entire life cycle of the container.

  • Create a container
    • New Container
      • Create a simple container, said simply complicated and very complex, he has many options, including the mode of operation of container, container environment configuration, security, resource constraints and container container and so on. . , Or take some time to master, the following is simply called by a mirror ubuntu, the label for the latest mirroring, create a container.
      • docker create -it ubuntu:latest
    • Start container
      • After you create a container, we adopted the following command to start up the container.
      • docker start 182ead1dfa60
    • New and launch container
      • We can use the following command to create and direct start.
      • docker run ubuntu:latest 
    • The guardian of the state run
      • Create a container plus -d container, in order to protect state run in the background.
      • docker run  -d ubuntu:latest
    • View content output
      • Obtaining container output
      • docker logs 182ead1dfa60
  • Stop the container
    • Suspended container
      • Start container docker start 182ead1dfa60
      • Pause container docker pause testcon
      • View container paused
      • Suspended container may restart command to restart the container docker restart 182ead1dfa60 
    • Termination container
      • docker stop 182ead1dfa60
      • The container can be used in a termination state id container docker start to start.
  • Into the container
    • attach command
      • If you create a boot container using the -d parameter, the vessel will start into the background, so enter the vessel through the attach command, you can view or operation of the internal container.
      • Examples: docker attach c071248c8388
    • exec command
      • It is relatively attach more convenient. Can execute arbitrary commands directly in the operation of the vessel, the further we can do other operations
      • docker exec -it c071248c8388 /bin/bash
  • Delete container
    • It can be deleted after can be deleted by the Delete command in the termination of the state or states to exit the container, if the container is running is not deleted, it needs to stop.
    • If you want to forcibly remove the container running command with the -f can.
    • docker rm -f c071248c8388
    • docker rm c071248c8388
  • Export Import Container
    • Export Container
      • Sometimes we need a container to migrate from this server to another server, we can export the container.
      • docker export -o test.tar testcon
    • Import Container
      • docker import test.tar - test/ubuntu:v1.0
  • View container
    • View container details
      • You can view the container-specific information, including the id of the container, creation time, status, etc.
      • docker container inspect testcon
    • View container process
      • View container process information
      • docker top testcon
    • View statistics
      • Displays the contents of cpu usage and other network information
      • docker stats testcon
  • other
    • Copy files
      • Docker can copy files between the host provides a command vessel
      • docker cp data test : /tmp/
    • Change View
      • docker container diff testcon
    • View port mapping
      • docker container port testcon
    • Update Configuration
      • docker update testcon  [CONTAINER...]

Guess you like

Origin www.cnblogs.com/dgdg338/p/11729797.html