Docker Команды:
======================================
// stop all Docker containers:
# docker stop $(docker ps -a -q)
// remove all Docker containers:
# docker rm $(docker ps -a -q)
// remove all Docker images:
# docker rmi $(docker images -q)
=====================================
// Подключиться к стартованному контейнеру:
# docker attach 80075ddd71e8
// Отключиться от конейнера, не завершив его работу
Удерживая CTRL нажать P затем Q
=====================================
// узнать IP Контейнера Docker
docker inspect --format='{{.NetworkSettings.IPAddress}}' containerId
=====================================
# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos centos6 b1bd49907d55 4 weeks ago 212.5 MB
# docker images --tree
Warning: '--tree' is deprecated, it will be removed soon. See usage.
└─511136ea3c5a Virtual Size: 0 B
└─34e94e67e63a Virtual Size: 0 B
└─b1bd49907d55 Virtual Size: 212.5 MB Tags: centos:centos6
-- Посмотреть конфиг image:
$ sudo docker inspect centos/web_server
==========================
-- Разместить контейнер на https://hub.docker.com/
-- Завел учетку marley. Создал repository centos6_web_server
$ sudo docker tag centos/web_server marley/centos6_web_server
$ sudo docker push marley/centos6_web_server
==========================
// Логи
docker logs --tail 0 -f 80075ddd71e8
# docker info
Containers: 13
Images: 3
Storage Driver: devicemapper
Pool Name: docker-8:2-28704921-pool
Data file: /var/lib/docker/devicemapper/devicemapper/data
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 569.1 Mb
Data Space Total: 102400.0 Mb
Metadata Space Used: 1.6 Mb
Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 2.6.32-431.23.3.el6.x86_64
====================================
Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders from a container's filesystem to the host path
diff Inspect changes on a container's filesystem
events Get real time events from the server
export Stream the contents of a container as a tar archive
history Show the history of an image
images List images
import Create a new filesystem image from the contents of a tarball
info Display system-wide information
inspect Return low-level information on a container
kill Kill a running container
load Load an image from a tar archive
login Register or log in to the Docker registry server
logs Fetch the logs of a container
port Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
pause Pause all processes within a container
ps List containers
pull Pull an image or a repository from a Docker registry server
push Push an image or a repository to a Docker registry server
restart Restart a running container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image to a tar archive
search Search for an image on the Docker Hub
start Start a stopped container
stop Stop a running container
tag Tag an image into a repository
top Lookup the running processes of a container
unpause Unpause a paused container
version Show the Docker version information
wait Block until a container stops, then print its exit code