Docker Notes
Docker 学习笔记
文件格式
安装(Mac)
Docker for Mac
下载
- Stable: https://download.docker.com/mac/stable/Docker.dmg
- Edge: https://download.docker.com/mac/edge/Docker.dmg
Notes: Docker for Mac requires OS X El Capitan 10.11 or newer macOS release running on a 2010 or newer Mac, with Intel’s hardware support for MMU virtualization.
Toolbox for Mac (legacy)
下载
- https://download.docker.com/mac/stable/DockerToolbox.pkg
安装(Windows)
Docker for Windows
下载
- Stable: https://download.docker.com/win/stable/InstallDocker.msi
- Edge: https://download.docker.com/win/edge/Docker%20for%20Windows%20Installer.exe
- Legacy Edge: https://download.docker.com/win/edge/InstallDocker.msi
Toolbox for Windows (legacy)
下载
- https://download.docker.com/win/stable/DockerToolbox.exe
安装(Linux)
Check Kernel compatibility
curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh -s | bash
CentOS
# remove old versions
sudo yum remove docker \
docker-common \
container-selinux \
docker-selinux \
docker-engine
# Install required packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum-config-manager --enable docker-ce-edge
sudo yum makecache fast
# INSTALL DOCKER
yum list docker-ce.x86_64 --showduplicates | sort -r
sudo yum install docker-ce.x86_64
sudo cat <<EOF>/etc/docker/daemon.json
{
"storage-driver": "devicemapper"
}
EOF
sudo systemctl start docker
sudo systemctl enable docker
sudo groupadd docker
sudo usermod -aG docker $USER
docker run hello-world
## Uninstall, Caution!!!
# sudo yum remove docker-ce
# sudo rm -rf /var/lib/docker
Debian
sudo apt-get remove docker docker-engine
# Jessie or Stretch
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
# Wheezy
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
python-software-properties
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
# Wheezy only: comment out the following line
#deb-src [arch=amd64] https://download.docker.com/linux/debian wheezy stable
sudo apt-get update
apt-cache madison docker-ce
sudo apt-get install docker-ce=<VERSION_STRING>
# Uninstall, Caution!!!
# sudo apt-get purge docker-ce
# sudo rm -rf /var/lib/docker
Install docker-compose
https://docs.docker.com/compose/install/
# version check: https://github.com/docker/compose/releases
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
清理 docker 文件
docker system prune -a
docker ps -a -q --filter="status=exited" | xargs docker rm
docker images -q -f dangling=true | xargs docker rmi