Docker Commands

Table of Contents

Docker misc.


Install

Alpine

apk add docker docker-compose

Ubuntu

apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] http://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install docker-ce docker-ce-cli containerd.io

Non-root

sudo adduser <user> docker

Import/Export Image

Manual

docker save -o <output tar> <image name>
docker load -i <tar file>

Push

Push from source to target.

docker save <image> | bzip2 | ssh user@host 'bunzip2 | docker load'

OR

docker save <image> | bzip2 | pv | ssh user@host 'bunzip2 | docker load'

Pull

ssh target_server 'docker save image:latest | bzip2' | pv | bunzip2 | docker load
John Siu
Minimize the Effort, Maximize the Effect!
comments powered by Disqus