[ref]
http://www.openfoundry.org/tw/tech-column/9319-docker-101
https://docs.docker.com/installation/amazon/
https://docs.docker.com/installation/ubuntulinux/
https://docs.docker.com/userguide/
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-getting-started
docker networking problem
https://blog.codecentric.de/en/2014/01/docker-networking-made-simple-3-ways-connect-lxc-containers/
//=== install docker on ec2 ubuntu
https://docs.docker.com/installation/amazon/
""" ...
There are several ways to install Docker on AWS EC2.
You can use Amazon Linux, which includes the Docker packages in its Software Repository,
or ...
...
for example a Standard Ubuntu Installation.
... """
//=== to install docker on Ubuntu14 is easier than Ubuntu12
$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo docker info
Containers: 0
Images: 0
...
*** after install docker.io
having docker installed, in general we shall have the
docker daemon running in the background.
If not, run the docker daemon:
$ sudo docker -d &
//===
??? to enable tab-completion of Docker commands in BASH,
either restart BASH or:
$ source /etc/bash_completion.d/docker.io
//== login docker.com
$ sudo docker login
Username: [ENTER YOUR USERNAME]
Password:
Email: [ENTER YOUR EMAIL]
Login Succeeded
$ sudo docker run centos:centos6 /bin/date
$ sudo docker run -t -i centos:centos6 bash
[ centos:centos6 === repo_name:tag ]
$ sudo docker search centos
[find out repos with keyword 'centos']
-->
# whoami
# w
--> to close the container
# exit
or
# Ctrl + D,
--> to leave the container tty shell [container still run in background]
# Ctrl + P then Ctrl + Q
ctl+p then ctl+q
//=== after going back to the host ubuntu shell
$ sudo docker ps [show the running containers]
$ sudo docker ps -a [show containers history]
$ sudo docker images [show images, 'image' : the committed container snapshot]
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos centos6 70441cac1ed5 3 weeks ago 215.8 M
...
--> to resume to the running container
$ sudo docker exec -t -i 0f83f1728262 bash
[0f83f1728262 is the container_id]
Error: Command not found: exec
-->
http://askubuntu.com/questions/581234/docker-exec-command-is-not-working
""" docker exec command will support in new versions only.(>1.3) """
-->
Try docker attach
$ sudo docker attach container_id
[enter again?]
[rm container]
$ sudo docker rm 0f83f1728262
0f83f1728262
//=== -v mount point inside the container
sudo docker run -t -i -v /myData centos:centos6 bash
//=== -v [HOST_DIR]:[CONTAINER_DIR]
mount folder on host OS to the mount point inside the container
[ex]
host folder: /home/uuu13/docker/try1/
mount point in container: /myApp
$ sudo docker run -t -i -v /home/uuu13/docker/try1/:/myApp reponame bash
//===
$ sudo docker search php
$ sudo docker pull tutum/apache-php [dnload repo image]
Pulling repository tutum/apache-php
...
//===
$ sudo docker run -t -i tutum/apache-php bash
[ create a new container from repo 'tutum/apache-php'
and open an interactive tty with bash shell ]
""" ...
Container 內 PHPUnit 安裝(示範用):
root@aeeb1980c96e:/app# apt-get update
root@aeeb1980c96e:/app# apt-get install wget php5-xdebug
root@aeeb1980c96e:/app# cd /usr/local/bin ; \
> wget https://phar.phpunit.de/phpunit.phar
root@aeeb1980c96e:/usr/local/bin# chmod +x phpunit.phar
root@aeeb1980c96e:/usr/local/bin# mv phpunit.phar \
> phpunit
root@aeeb1980c96e:/usr/local/bin# exit
[離開 container...]
目前,我們已經建立一個新的 container,container ID 為 aeeb1980c96e 。
... """
""" ...
$ sudo docker commit -m="Add PHPUnit and xdebug" \
> -a="Huang Yi-Ming" aeeb1980c96e \
> ymhuang0808/phpunit-testing:php5.5.9
ymhuang0808/phpunit-testing ...
通常斜線( / )前面為在 Docker Hub 的帳號名稱(前面部分有註冊 Docker Hub 帳號),後面則是 repo 名稱.
php5.5.9:tag 名稱,
... """
//===
$ sudo docker search angular
$ sudo docker pull florentbenoit/docker-angularjs-tutorials
*** https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-getting-started
""" ...
Remember that with docker, commits are cheap.
Do not hesitate to use them to create images to save your progress with a
container or to roll back when you need (e.g. like snapshots in time).
... """
//=== https://groups.google.com/forum/#!topic/docker-user/thYVhVQ0Zfs
$ sudo docker commit -m="try angularjs docker" \
0b5f4a913336 \
3hdeng/angularjs-docker-try:angular-try-1
-->
error: No such container:
""" ...
You're trying to commit an image, not a container.
Do `docker ps -a` to see container
... """
*** image_id is different from container_id
image_id --> sudo docker images
container_id --> sudo docker ps -a
[remove container]
$ sudo docker rm container_id
[remove image]
$ sudo docker rmi username/repo_name:tag
//=== to install docker on Ubuntu Precise 12.04 (LTS) (64-bit)
*** to install docker on older release/kernel needs kernel update first
--> Linux kernel 3.8
""" ...
Due to a bug in LXC, Docker works best on the 3.8 kernel. Precise comes with a 3.2 kernel, so we need to upgrade it. ...
Please read the installation instructions for backported kernels at Ubuntu.org ...
# install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
# install the backported kernel and xorg if using Unity/Xorg
$ sudo apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring
# reboot
$ sudo reboot
... """
2015年2月5日 星期四
docker install on EC2 ubuntu
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言