dockernode
系統環境git
lq@lq-OptiPlex-755:~$ uname -a
Linux lq-OptiPlex-755 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linuxgithub
docker須要運行在root用戶下,不然有其餘問題。。。docker
安裝命令ubuntu
curl -sSL https://get.docker.com/ | bash -xbash
這個命令能夠查看安裝過程,建議先執行下 sudo apt-get updateapp
hello worldssh
root@lq-OptiPlex-755:/home/lq# docker search hello
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
hello-world Hello World! (an exampleDocker... 266 [OK]
tutum/hello-world Image to test docke. Has Apac... 31 [OK]
google/nodejs-hello 15 [OK]curl
.....ide
root@lq-OptiPlex-755:/home/lq# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest
root@lq-OptiPlex-755:/home/lq# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 48b5124b2768 7 weeks ago 1.84 kB
root@lq-OptiPlex-755:/home/lq# docker run --name hh 48b5124b2768
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
root@lq-OptiPlex-755:/home/lq# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e0065e063270 48b5124b2768 "/hello" 38 seconds ago Exited (0) 36 seconds ago hh
root@lq-OptiPlex-755:/home/lq# docker rm e0065e063270
e0065e063270
root@lq-OptiPlex-755:/home/lq# docker rmi 48b5124b2768
Untagged: hello-world:latest
Untagged: hello-world@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Deleted: sha256:48b5124b2768d2b917edcb640435044a97967015485e812545546cbed5cf0233
Deleted: sha256:98c944e98de8d35097100ff70a31083ec57704be0991a92c51700465e4544d08
docker-enter
docker enter用途:
docker容器沒起sshd服務的時候,能夠使用nsenter進入docker容器。
直接使用nsenter步驟稍微複雜,能夠使用docker-enter
安裝
wget -P ~ https://github.com/yeasy/docker_practice/raw/master/_local/.bashrc_docker;
. ~/.bashrc_docker
docker-compose
docker compose用途:
Docker Compose屬於一個「應用層」的服務,用戶能夠定義哪一個容器組運行哪一個應用,它支持動態改變應用,並在須要時擴展。
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
root@lq-OptiPlex-755:/usr/local/bin# docker-compose version
docker-compose version 1.11.2, build dfed245
docker-py version: 2.1.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
docker-machine
docker machine用途:
Docker的安裝流程很是複雜,用戶須要登陸到相應的主機上,根據官方的安裝和配置指南來安裝Docker,而且不一樣的操做系統的安裝步驟也是不同的。而有了Machine後,無論是在筆記本、虛擬機仍是公有云實例上,用戶僅僅須要一個命令。
curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
chmod +x /tmp/docker-machine &&
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
root@lq-OptiPlex-755:/usr/local/bin# docker-machine version docker-machine version 0.10.0, build 76ed2a6