The installation process on the Ubuntu 14.04 Server is the simplest and meets all the requirements for installing Docker, with the following setup script. If you are possible, please use the 14.04 version of Ubuntu to avoid digging holes for yourself. Installation
1
Curl-ssl http s://get.docker.io/ubuntu/| sudo sh test
1
sudo docker run-i-T Ubuntu/bin/bash
This step enters the container and runs an interactive shell. You can install some software, such as Apt-get install Git, and then clone a project Https://github.com/developerworks/bespoke-fx.git
1 2 3 4 5 6 7
Root@148bc0a45428:/root # git clone https://github.com/developerworks/bespoke-fx.git cloning into ' bespoke-fx ' ... Remote:counting objects:53, done. Remote:compressing objects:100% (37/37), done. Remote:total (Delta), reused (delta) unpacking objects:100% (53/53), done. Checking connectivity ... done.
The/root directory is a project we just clone down.
1 2 3 4 5 6 7
root@148bc0a45428:/root# ls-al Total drwx----3 root 4096 Aug 27 07:49. Drwxr-xr-x root root 4096 Aug 27 07:39. . -Rw-r--R--1 root root 3106 Feb 20 2014. Bashrc-rw-r--R--1 root root 140 Feb 20 2014. Profile Drwxr-xr-x 7 root root 4096 Aug 07:49 bespoke-fx
Now we exit the container.
We do it again.
1 2 3
sudo docker run-i-T Ubuntu/bin/bash cd/root Ls-al
The clone's Bespoke-fx directory disappears, the container's lifecycle ends, and the resources in its container disappear. Using the Docker hub Central mirrored warehouse
First need to register an account, there are two ways to register the account, one is through the Web Form registration, the other is through the command line registration through the form
Go to the following link, go to the registration page, fill in the username, password, mail. You will receive an activation email later and enter the priority click Activation button.
1
HTTP S://hub.docker. com/account/signup/is registered by the command line
Run sudo docker login and follow the prompts to fill in the username, password and message.
1 2 3 4 5
$ sudo docker login Username:fill-your-name password:email:fill-your-email-address@gmail.com account created. Please use the confirmation link we sent to your e-mail to activate it.
Re-execute sudo docker login login Docker Hub
1 2 3
$ sudo docker login Username (rainflowerpebbles): Login succeeded How to check, monitor and manage containers Docker PS Display the currently running container, this command is similar to the operating system PS command, the PS command shows Shows the current operating system running process, while Docker PS displays the currently running container, in order to help understand, you can take the container as a running process. Docker logs displays a container's standard output Docker stop stops a running container to display and stop the container
Open two terminals, run sudo docker run-i-T Ubuntu/bin/bash at the first terminal
Run the following command at the second terminal:
1 2 3 4 5
$ sudo docker PS CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3fc975a5dcaf ubuntu:14.04 "/bin/bash" 6 seconds AG O up 5 seconds Drunk_perlman $ sudo docker stop 3FC975A5DCAF 3FC975A5DCAF
Back to the first terminal, you see
1 2
Root @3fc975a5dcaf:/# Exit $
Shell running from inside the container back to the operating system Shell display container standard output
or open two terminals, execute at the first terminal:
1 2 3
$ sudo docker run-i-T ubuntu/bin/bash root@ 2da06a3b3b8a:/# ls bin boot dev etc home lib lib64 media mnt opt proc Root Run sbin SRV sys tmp usr var
Perform sudo docker logs 2da06a3b3b8a at a second terminal:
1 2 3
$ sudo docker logs 2da06a3b3b8a root@ 2da06a3b3b8a:/# ls bin boot dev etc home lib lib64 media mnt opt proc Root run sbin SRV sys tmp usr var display details
1
$ sudo docker ps-l
The-l tag details for the output container show containers that have stopped
1
$ sudo docker ps-a
-A flag shows containers that have stopped