Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Create the container and run the application Docker     - Oracle how to assess the true concurrent session (Database)

- Win7 used Eclipse to connect the virtual machine in Ubuntu Hadoop2.4 (Server)

- Php and MySQL command add to the environment variable method in Linux system (Linux)

- Figlet use (Linux)

- Use Docker containers (Linux)

- Get basic information about Linux server script (Server)

- CentOS How to mount the hard drive (Linux)

- Linux operating system security settings initial understanding (Linux)

- ORA-27054 NFS problem solving (Database)

- Fatal: unable to connect to github.com problem solving (Linux)

- map and hash_map STL containers (Programming)

- Ubuntu 15.04 installation MATE 1.10 (Linux)

- DIY security of Linux platform (Linux)

- Kibana Apache Password Authentication (Server)

- Hadoop namenode do NFS disaster recovery (Server)

- Ubuntu 14.10 / Linux Mint 17.1 Win10 compiler install rdesktop 1.8.3 Remote Desktop connection (Linux)

- Linux filtration empty file command summary (Linux)

- Create Your Own Docker base image in two ways (Linux)

- How to install CentOS CentOS web page (Server)

- Linux System Getting Started Tutorial: Using the Linux common commands (Linux)

 
         
  Create the container and run the application Docker
     
  Add Date : 2018-11-21      
         
         
         
  1. We recognize the docker is working properly, we first need to obtain the latest CentOS mirrors

$ Docker pull centos: latest

$ 2. docker images centos Docker View Mirror

[Root @ docker ~] # docker images centos

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

centos latest 7322fbe74aa5 6 weeks ago 172.2 MB

$ 3. docker run -i -t centos / bin / bash bash shell to run a simple test to create this image

4. Create Docker Hub account

There are two types of access can create and register a Docker Hub account:

 1. Adoption of the website, or

 2. Command Line

Through the website registration

Fill in the registration form, select your user name and password and set your e-mail. You can also sign up for the mailing list docker, there will be a lot of information about the docker's

Command to log DockerHub

$ Docker login

5. Run "Hellow wrold" in the Docker

6. $ Docker run centos / bin / echo 'hello world' to run the first container

7.Docker run we have run those steps specified command Docker binary we want to implement, run. docker run combined operation containers, mirroring is running centos (when specified image does not exist it will be downloaded from the public image library), and then perform run Create a container, and then tell what Docker run command \ bin \ echo in a new container, it You will see the results hello world, if Docker container input command is activated here as long as hello word output, the container will stop.

$ 8. docker run -t -i Ubuntu: 14.04 / bin / bash -t and -i. -t Flag heart vessel designated a pseudo-terminal or terminal, -i label allows us to interact STDIN container. / Bin / bash. This will start the bash shell within the container;

When you run commands finished, enter exit to exit.

9. $ docker run -d ubuntu: 14.04 / bin / sh -c "while true; do echo hello world; sleep 1; done"

1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147

docker but we specify a -d logo. -d identifies tell docker container to run in the background mode.

This is a ridiculous hello word process: a script will always output "hello word"

? Why do not we see a lot of "hello word" but a long string returned docker:

1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147

This long string called container ID. It is the unique identifier of the container, so we can use it.

 Note: The container ID is a bit long and very awkward, later on we will see a breakpoint ID, in some respects it is a simplified version of the container ID.

10.docker ps command must ensure that the container is running

11. # We can use docker ps -a command to view (without concern for containers is not running). docker ps command can check all containers docker process.

12. [root @ docker ~] # docker ps -a

13.CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

d162d83800cf centos: latest "/ bin / bash" 2 days ago Exited (0) 2 days ago reverent_mclean

325af222cdd9 centos: latest "/ bin / echo 'hellow w 2 days ago naughty_stallman

6452d29e7540 centos: latest "/ bin / bash echo 'hel 2 days ago Exited (126) 2 days ago adoring_mccarthy

db8321ced433 centos: latest "/ bin / bash" 2 days ago Exited (0) 2 days ago silly_euclid

a1edce86da9b centos: latest "/ bin / bash" 2 days ago Exited (0) 2 days ago angry_goodall

41035d2328ea centos: latest "/ bin / bash" 3 days ago Exited (0) 3 days ago

14.docker ps command will return some useful information here, including a short container ID: d162d83800cf. Automatically assigned the name: reverent_mclean

15. Note: docker automatically named to the container when the container starts later we can see how we have to specify the name of the vessel.

16. We need to use the command docker logs (container running) in our container.

Let us give the system automatically assigns the name of the vessel using this command.

$ Docker logs angry_goodalldocker logs command which looks like a run in the container and return to the standard output: In this case our command output hello word fantastic; stop the daemon container. To this end let us use docker stop command to stop.

$ Docker stop insane_babbagedocker stop command to stop the container will notify docker running. If it succeeds, it returns the name of the vessel immediately after it stops. By docker ps command to check that it is still working. $ Sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
     
         
         
         
  More:      
 
- Linux asynchronous read documents by AIO (Programming)
- innodb storage engine backup tool --Xtrabackup (Database)
- Java memory model subclasses (Programming)
- Android Studio quick overview of Gradle (Programming)
- Ubuntu modify locale problem solving (Linux)
- Mac OS X system setup Google Go language development environment configuration tool Sublime Text 2 (Linux)
- OpenGL Superb Learning Notes - New Patterns (Programming)
- RabbitMQ user roles and access control (Linux)
- Nginx caching using the official guide (Server)
- How to install and use the Snort in Ubuntu 15.04 (Linux)
- PostgreSQL 9.3.5 database installation under Ubuntu Server 14.04 (Database)
- MySQL separation Amoeba achieve literacy (Database)
- Large site architecture study notes (Server)
- pkg-config to use (Linux)
- Linux system Passwd file detailed analysis (Linux)
- C ++ Supplements - Smart Pointers (Programming)
- Spring next ActiveMQ combat (Programming)
- How to configure Ceph stored on CentOS 7.0 (Server)
- Linux using TCP-Wrapper Service Management (Linux)
- Installation and use of Linux Sniffer tool Tcpdump (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.