2019年3月23日 星期六

Docker 安裝流程

原本的 Docker 安裝流程是寫在另一篇文章中,後來覺得有必要寫更詳細一些
所以決定再寫一篇


1. 安裝 Docker CE


參考: https://docs.docker.com/engine/installation/

1-1. 移除舊版本


sudo apt-get remove docker docker-engine docker.io

1-2. 安裝 Docker CE


SET UP THE REPOSITORY
sudo apt-get update

sudo apt-get install \
  apt-transport-https \
  ca-certificates \
  curl \
  software-properties-common

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"

INSTALL DOCKER CE
sudo apt-get update
sudo apt-get install docker-ce

VERIFY
sudo docker run hello-world


2. Docker run as non-root


這個是非必要的動作,不過在開發時會比較方便

參考 :



Add the docker group if it doesn't already exist:
sudo groupadd docker

Add the connected user $USER to the docker group. Change the user name to match your preferred user if you do not want to use your current user:
sudo gpasswd -a $USER docker

Either do a newgrp docker or log out/in to activate the changes to groups.
You can check if you can run docker without sudo:
docker run hello-world

沒有留言:

張貼留言