# Docker安裝 1. 安裝 Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach. (執行docker下載官網第一種方法的第一與第三步驟,第二部驟用來選擇版本,如果沒有對版本有特殊需求,可直接略過第二部驟) 以下為對Docker安裝最新版(省略第二部驟的程式碼) ``` yum install -y yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum-config-manager --enable docker-ce-nightly yum-config-manager --enable docker-ce-test yum-config-manager --disable docker-ce-nightly yum install docker-ce docker-ce-cli containerd.io systemctl start docker docker run hello-world ``` [原文網址](https://docs.docker.com/engine/install/centos/) [影片教學](https://www.youtube.com/watch?v=i7w7uIJmh_M&list=PLmOn9nNkQxJFX0YVLDw5EMUL-4cVzXL33&index=8) 2. 指令觀念 * 最後一個指令 docker run hello-world 意思是到本機找一個叫做hello world的鏡像(image)運行,但因為本機裡並不存在該鏡像,所以跑出Unable....但隨後程式會自動到docker hub去找所以後續顯示運行成功。 * docker run 會到本機尋找該鏡像,沒有則會到 docker hub 尋找,若有則下載到本機運行。 ###### tags: `docker`