systemctl enable docker
systemctl status docker

# Delete all containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

# Delete all images
docker rmi $(docker images -q)

# fix missing btrf storage driver
sudo rm -rf /var/lib/docker/aufs

Debug / Run test container
docker info
docker run hello-world
#docker run -it centos bash
docker run -it ubuntu

Login to container
docker exec -it CONTAINER_ID bash

#docker run -i --rm ubuntu bash

sudo docker run -i -t --name dc-ubuntu ubuntu bash
sudo docker start -i dc-ubuntu

# wordpress
docker run -d --name dc-mysql -e MYSQL_ROOT_PASSWORD=mysqlpwd mysql
docker run -d --name dc-wordpress --link dc-mysql:mysql -p 7894:80 wordpress

# search
docker search icinga
docker search --filter is-official=true ubuntu
docker pull phre/icinga

docker run --name dc-nginx -d -p 7890:80 nginx
docker logs dc-nginx

# images
sudo docker images
sudo docker rmi 3eXXXXx

apt-get install docker
docker run -t -i --rm ubuntu bash
docker run -i -t --name dc-ubuntu ubuntu bash
docker start -i dc-ubuntu
docker run --name dc-nginx -d -p 7890:80 nginx
docker logs dc-nginx
docker stop dc-nginx
docker rm dc-nginx
docker run --name dc-nginx -d -p 7890:80 -v /tmp/srv/:/usr/local/nginx/html:ro nginx
docker run --name dc-nginx-tmp -t -i nginx /bin/bash
docker commit dc-nginx-tmp img-mynginx
docker run --name dc-mynginx -d -p 7891:80 img-mynginx nginx

# view all cointainer (also inactive)
docker ps -a

# remove all container
docker ps -qa | xargs docker rm

FROM nginx
RUN echo 'Hello again! ' > /usr/local/nginx/html/index.html

docker build -t=img-mynginx2 /tmp/dbuildtst/

docker run --name dc-mynginx2 -d -p 7892:80 img-mynginx2

Run Docker inside LXC container
echo 'DOCKER_OPTS="--exec-driver=lxc"' | tee -a /etc/default/docker
service docker restart

# mysql container
sudo docker pull mysql

# build a container

# notes
docker run --lxc-conf="" my_image ifconfig
edit /etc/default/docker: DOCKER_OPTS="--dns -e lxc"
apt-get install lxc (lxc-docker is not enough)
docker run --lxc-conf="" -t myimage

# non root?

# quick & easy install
wget -qO- | sh

# docker under LXC
cat /var/lib/lxc/docker/config
lxc.aa_profile = unconfined
lxc.cgroup.devices.allow = a
lxc.cap.drop =

# 15 Quick Docker Tips

# get volume information
for VOLUME in $(docker volume ls -q); do
docker volume inspect ${VOLUME}

# delete unused volumes
docker volume rm $(docker volume ls -qf dangling=true)

# service


Docker Machine

Docker Compose

List content of docker repository
curl -X GET http://${DOCKER_REPOSITORY_IP}:5000/v2/_catalog | python -m json.tool

Create profile with connection to VLAN
lxc profile copy default mgmt-dev
# lxc profile list
lxc profile device set mgmt-dev eth0 nictype macvlan
lxc profile device set mgmt-dev eth0 parent mgmt-dev-v1234
lxc profile show mgmt-dev

curl -X GET http://${DOCKER_REPOSITORY_IP}:5000/v2/${DOCKER_CONTAINER}/tags/list | python -m json.tool