Install Docker on Linux
# Install Docker
curl -fsSL https://get.docker.com | sh
# Install Docker w $HOME jako non-root
curl -fsSL https://get.docker.com/rootless | sh
Install Docker helpers
# Windows
$ Set-ExecutionPolicy RemoteSigned
$ Install-Module posh-docker
$ Import-Module posh-docker
# Mac
$ brew tap homebrew/completions
$ brew install docker-completion
$ brew install docker-compose-completion
# Linux
$ apt install bash-completion
$ curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh
Uruchomienie pierwszego kontenera :)
docker run hello-world
Sciagniecie obrazu
docker pull IMAGE
Wylistowanie obrazów
docker images
Uruchomienie obrazu
docker run -it IMAGE komenda
Wylistowanie kontenerow
docker ps
Podlaczenie sie do dzialajacego kontenera
docker exec -it CONTAINER bash
Kopiowanie danych
docker cp CONTAINER:SRC_PATH DEST_PATH
Przekierowanie portow
docker run -it -p 80:80 IMAGE
Budowanie obrazu
docker build -t NAZWA:tag .
Podgląd komunikacji z kontenerem
socat -d -d -t100 \
-lf /dev/stdout \
-v UNIX-LISTEN:/var/run/docker.debug,mode=777,reuseaddr,fork \
UNIX-CONNECT:/var/run/docker.sock
DOCKER_HOST=unix:///var/run/docker.debug docker ps
Wysłanie rządania do docker engine
curl -sSf --unix-socket /var/run/docker.sock 0/containers/json
Wejście do maszyny wirtualnej linuxa
# Windows and Mac
docker run -it --rm --privileged --pid=host justincormack/nsenter1