7
docker pull registry - get image with running registry (local docker hub)
12
docker images - local images
13
docker history <image> - show the building history of the image
14
docker build --tag chsa/adei . - build new image using Dockerfile
15
docker push chsa/adei - publish on docker hub
17
Working with containers
18
-----------------------
19
docker run -it chsa/adei /bin/bash - Create the container and start it
20
-it - Interactive, i.e. terminal to the sssion
21
-d - Start detached container (allows running multiple copies of the same image)
22
-rm - Automatically remove on stop
23
-P - Publish all listening container ports to host system (ports are not necessarily the same, find out with docker port)
24
-p [host_port:virt_port] - Instruct to map ports (uses DOCKER chain in nat & default iptables)
26
--link container:alias - Allow to connect to '<container>' from the newly running container as 'alias' and will also
27
add some environmental variables about it configuration (check with set | grep MYSQL)
28
--volumes-from <container> - mount all mounts from the specified container (if corresponding directories exists)
29
-v /path - provided a permanents storage in the specified location
30
-v /host_path:/path - map a host folder in the specified location (also a single file can be mounted)
32
-m 512MB - limit amount of memory available for container
33
--cpuset-cpus 0-2,5 - limit CPU cores which will run container (efficiently may limit CPU usage)
34
--cpu-period 2 --cpu-quota 4 - Tell CFQ scheduler to give VM 4us on CPU for each period of 2us (i.e. allow full usage of 2 CPU cores), the default period is 100,000us
37
docker port adei-mysql 3306 - report there is mapped the specified port of container
38
docker top adei-mysql - usage
39
docker logs adei-mysql - display logs
41
docker ps [-a] - list running (and terminated) containers
42
docker inspect adei-mysql - get information about container (environment, mounts, etc.)
43
docker exec -ti adei-mysql /bin/bash - run additional command in running container context
44
docker stop/start - stop / restart stopped container
45
docker attach - attach to terminal of the container
48
docker commit <name> chsa/adei - save modified container as an image
49
docker export -o state.tar <name> - preserve the current state
50
docker rm <name> - destroy currently runnign container
51
-v - remove all associated volumes
55
* Remove all stopped containers
56
docker rm $(docker ps -q -f status=exited)