Docker, 2013 , — , «». , , Google, Amazon VMware Docker , . ? Docker, , .
Docker?
— , , . Docker Docker. , , , , , , .
Docker
Docker — :
- , Docker, . Registry, — , Docker.
- , Docker.
- registry, . , , , Docker Hub Docker Cloud.
Registry
Docker Registry Docker. : Docker Hub Docker Cloud. Docker Hub — , .
Docker
:
Docker
Docker:
- build, Docker
- create,
- kill.
- dockerd, Docker
- commit,
Docker?
Docker — , . , . , , .
Docker Swarm?
Docker Swarm ( swarm mode, . ) — Docker, . Docker .
Docker?
, :
docker ps -a
. .
Docker, Docker run?
Docker — , , , . , . Docker run , , Docker. .
Docker
Docker :
- ;
- , ;
- ;
- ;
- ;
- .
Docker?
, .
— .
— .
— Docker, swarm.
.
Docker: (stateful) (stateless)?
(stateless) Docker, (stateful). . . , . Docker.
Dockerfile?
Dockerfile , Docker. , , , , .
Docker?
:
- bridge, , , .
- none, .
- host, .
, Git
, , :
- Docker build
- Registry
- , Registry
- HTTP(S)
Docker ?
Docker — , . Docker, , , . Docker — , , , .
Docker , . DockerHub, Registry , . — . Docker , .
— ?
Docker , , , — . , . : .
Docker ?
Docker stats Docker events. . stats , . top. events, Docker. : , commit, , .., .
Docker
Docker:
- c Dockerfile, .
- , . — Dockerfile.
- , Registry, .
- . , .
docker run
docker create
, . docker create
. docker run
, --cidfile FILENAME
, .
?
, , . , x86, .
? . , — , , .. , (host) , .
:
Registry Repository?
Registry — , DockerHub — Registry . Repository — . , .
JSON YAML docker-compose, — ?
, . , :
docker-compose -f docker-compose.json up
CMD ENTRYPOINT Dockerfile
Dockerfile , . , :
- , CMD ENTRYPOINT, Dockerfile.
- — ENTRYPOINT .
- — CMD .
Linux, Docker
- Docker;
- Docker Hub;
- ;
- , ;
- ;
- ;
- ;
- .
?
, , — . . , , , .., , . :
- , , ;
- , , .
. , / .
Docker, DockerHub, Dockerfile
: , , . . Docker .
DockerHub: . , , , GitHub (Bitbucket), DockerHub. Docker.
Dockerfile: , . . Docker .
Docker client Docker server?
Docker docker version []
. , , . , :
docker version --format '{{.Server.Version}}'
Docker Repository
Docker Repository, :
docker login [OPTIONS] [SERVER]
, registry, (), :
$ docker login localhost:8080
Docker
- docker push: Registry;
- docker run: ;
- docker pull: Registry;
- docker start: ;
- docker stop: ;
- docker search: DockerHub;
- docker commit: .
Docker ?
Docker . , . , . .
Docker?
Docker Windows (x86_64), Linux (x86_64, ARM, s390x, ppc64le).
?
, . Docker :
- Off: , ;
- On-failure: , ;
- Unless-stopped: , ;
- Always: , .
:
$ docker run -dit — restart [unless-stopped|off|on-failure|always] [CONTAINER]
Docker?
, , , , — , . , .
Docker
Created — , .
Restarting — .
Running — .
Paused — .
Exited — .
Dead — , , .
, . :
- ;
- ;
- ;
- ;
- ;
- , .
memory-swap
memory-swap , , . , memory. , memory = "400m" memory-swap = "1g", 400 600 (1-400).
Docker?
, Docker ( -Docker ), Docker /var/lib/docker/volumes/
. — Docker.
Docker
:
docker -version: Docker;
docker ps: ;
docker ps -a: , , ;
docker exec: ;
docker build: Dockerfile;
docker rm: ;
docker rmi: ;
docker info: Docker, , , , , ..;
docker cp: ;
docker history: .
systemd Docker
Docker Linux systemd. systemctl
. , service
.
$ sudo systemctl start docker
$ sudo service docker start
, :
$ sudo systemctl enable docker
$ sudo systemctl disable docker
:
$ sudo systemctl edit docker
:
$ journalctl -u docker
Docker
docker-compose scale
. :
- n :
$ docker-compose --file docker-compose-run-srvr.yml scale <service_name>=<n>
docker-compose-run-srvr.yml
, n , n — .
- :
$ docker ps -a
CNM?
CNM Container Network Model — , , , . CNM : sandbox (), .
Docker?
- Bind mount: ;
- Volume mount: Docker ;
- tmpfs mount: , .
Docker Trusted Registry
Docker. , . DTR CI/CD , . , .
docker_host?
URL unix, API Docker. — unix://var/run/docker.sock
TCP, :
tcp://192.0.1.20:3230
compose ? ?
docker-compose, YAML . . , :
- Dockerfile,
- docker-compose.yml
- docker-compose up
Docker
Docker — -, . . , , , , , , , swarm . , .