preparation
★ubuntu i386版本無法裝docker,一定要amd64版本才能裝docker。
sudo -s
apt-get install htop iftop iotop unzip p7zip p7zip-full rar unrar openssh-server openssh-client
service sshd status
reboot
★under ubuntu16.04 amd64
sudo -s
uname -a
cat /etc/lsb-release
apt-get update
apt-get upgrade
install docker
curl -sSL https://get.docker.com/ | sudo sh
service docker status
docker version
docker info
test docker works
docker run hello-world
search and pull
docker search ubuntu
docker pull ubuntu
docker pull java
docker pull tomcat
docker pull mysql
docker pull jplock/zookeeper:3.4.6
docker pull ches/kafka
docker pull sequenceiq/spark:1.6.0
docker pull dylanmei/zeppelin
basic
docker pull ubuntu
docker create ubuntu:16.04
docker run -i -t ubuntu:16.04 /bin/bash
df -h
docker run -i -t -d ubuntu:16.04 /bash/sh -c “while true;do echo hello world;sleep 1; done” # -d run in background
docker ps #show containers
docker logs {container_id}
docker exec -i -t {container_id} /bin/bash
docker stop {container_id}
docker start {container_id}
docker rm {container_id}
docker rm {container_id} -f
pull, create, show, remove image
docker pull ubuntu
docker create ubuntu:16.04
docker images #show all images
docker rmi {image_name} #delete specific image
references
https://docs.docker.com/engine/installation/linux/ubuntulinux/
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
https://www.howtoforge.com/tutorial/docker-installation-and-usage-on-ubuntu-16.04/
https://philipzheng.gitbooks.io/docker_practice/content/install/ubuntu.html #quiet old 2014
常用 official images
rabbitmq
memcached
radis
cassandra
nginx
httpd
haproxy
jenkins
kibana
elasticsearch
logstash
postgres
mariadb
java
tomcat
mysql
ubuntu
debian
centos
solr
maven
jetty
cAdvisor
1 | docker run \ |
install docker-machine
@see https://github.com/docker/machine/releases
@see https://docs.docker.com/machine/install-machine/ https://docs.docker.com/machine/get-started/
@see https://www.digitalocean.com/community/tutorials/how-to-provision-and-manage-remote-docker-hosts-with-docker-machine-on-ubuntu-16-041
2
3
4
5
6
7
8
9root@ubuntu:~# date
Fri Aug 26 02:53:41 PDT 2016
root@ubuntu:~# curl -L https://github.com/docker/machine/releases/download/v0.8.1/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine && chmod +x /usr/local/bin/docker-machine
root@ubuntu:~# docker-machine --version
docker-machine version 0.8.1, build 41b3b25
root@ubuntu:~# docker-compose --version
docker-compose version 1.5.2, build unknown
root@ubuntu:~# docker --version
Docker version 1.12.1, build 23cf638
cheatscript
redis
docker run —name gitlab-redis -d \
—volume /srv/docker/gitlab/redis:/var/lib/redis \
sameersbn/redis:latest
postgresql 9.6
docker run —name gitlab-postgresql -d \
—env ‘DB_NAME=gitlabhq_production’ \
—env ‘DB_USER=gitlab’ —env ‘DB_PASS=password’ \
—env ‘DB_EXTENSION=pg_trgm’ \
—volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
sameersbn/postgresql:9.6
msql
docker run —name mysql -d \
-p 33306:3306 \
-e MYSQL_ROOT_PASSWORD=password \
-v /srv/docker/mysql/conf:/etc/mysql/conf.d \
-v /srv/docker/mysql/data:/var/lib/mysql \
mysql:5.7
docker run —name mysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mysql:5.7.10
docker exec mysql cat /etc/mysql/my.cnf
spark 1.6
docker run -i -t -h sandbox sequenceiq/spark:1.6.0 bash