2019年3月23日 星期六

Docker 安裝流程

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


1. 安裝 Docker CE


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

1-1. 移除舊版本


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

1-2. 安裝 Docker CE


SET UP THE REPOSITORY
  1. sudo apt-get update
  2.  
  3. sudo apt-get install \
  4. apt-transport-https \
  5. ca-certificates \
  6. curl \
  7. software-properties-common
  8.  
  9. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  10.  
  11. sudo add-apt-repository \
  12. "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  13. $(lsb_release -cs) \
  14. stable"

INSTALL DOCKER CE
  1. sudo apt-get update
  2. sudo apt-get install docker-ce

VERIFY
  1. sudo docker run hello-world


2. Docker run as non-root


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

參考 :



Add the docker group if it doesn't already exist:
  1. 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:
  1. 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:
  1. docker run hello-world

沒有留言:

張貼留言