首先安裝docker并啟動
wget https://download.docker.com/linux/centos/docker-ce.repo
mv docker-ce.repo /etc/yum.repos.d
yum install -y docker-ce
systemctl start docker && systemctl enable docker && systemctl status docker
安裝成功后 就拉取鏡像
安裝Docker之后盛正,運行以下命令以獲取最新的Portainer映像豪筝。·
[root@localhost ~]# docker search portainer
拉取鏡像
[root@localhost ~]# docker pull portainer/portainer
Using default tag: latest
latest: Pulling from portainer/portainer
d1e017099d17: Pull complete
292b789be2e4: Pull complete
Digest: sha256:63eb47d4b408c3f39e942368bcbf7e157a2b6e5dda94ffd403a14199e1137133
Status: Downloaded newer image for portainer/portainer:latest
docker.io/portainer/portainer:latest
查看鏡像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
portainer/portainer latest d1219c88aa21 2 weeks
啟動
[root@localhost ~]# docker run -d -p 9000:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name prtainer-test portainer/portainer
該語句用宿主機9000端口關聯(lián)容器中的9000端口敲街,并給容器起名為portainer-test严望。執(zhí)行完該命令之后,使用該機器IP:PORT即可訪問Portainer
第一次要創(chuàng)建密碼 密碼必須大于8個字符!2Υ摇!
單機版這里選擇local即可,選擇完畢台腥,點擊Connect即可連接到本地docker
注意:該頁面上有提示需要掛載本地 /var/run/docker.socker與容器內的/var/run/docker.socker連接黎侈。因此,在啟動時必須指定該掛載文件。
接下來使用 創(chuàng)建容器 例如 mysql
單擊左側的“App Templates”按鈕俱济。這將顯示一些現(xiàn)成的可用模板钙勃,例如Docker映像注冊表,Nginx蔚携,Httpd克饶,MySQl,WordPress等亡脑。
選擇要部署的容器,只需單擊相應的模板蛙紫。
這里讓我們啟動MySQL容器途戒。為此,請單擊MySQL模板唁毒。輸入容器名稱继准,選擇網(wǎng)絡類型(例如新娘模式)。單擊“Show advanced options”并設置端口號室谚。
點擊“Deploy the container”秒赤,過程會有點長憎瘸,耐心等待。