Docker

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Docker是一套提供容器(英语:Container)的软体。

安装

可以用这个一行指令直接安装:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -; sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"; sudo apt update; sudo apt install -y docker-ce

另外可以加装docker-compose:

sudo apt install -y docker-compose

或是比较新版的docker-compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose; sudo chmod 755 /usr/local/bin/docker-compose

范例

启动一个简单的Ubuntu环境:

docker run -i -t --rm ubuntu:latest /bin/bash

然后把APT的伺服器换掉:

perl -pi -e 's/archive.ubuntu.com/tw.archive.ubuntu.com/g' /etc/apt/sources.list
apt update -y

装些简单的东西:

apt install -y curl vim-nox wget

外部连结