Docker Portainer 설치 테스트 on CentOS 7
========== 모든 절차 (CentOS 7.x) 기본 ===========
# yum -y install docker
# cd /usr/libexec/docker/
# ln -s docker-runc-current docker-runc
# service docker start
# docker volume create portainer_data
# key=`docker run --rm httpd:2.4-alpine htpasswd -nbB admin 12345678 | cut -d ":" -f 2`
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --restart=always portainer/portainer --admin-password "$key"
# DEL_ID=`docker image ls |grep alpine |awk {'print $3'}`
# docker image rm $DEL_ID
=================================================
Docker CE
# yum install -y yum-utils device-mapper-persistent-data lvm2
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# yum install -y docker-ce
======= 이미지에 미리 반영 =======
# yum -y install docker
# cd /usr/libexec/docker/
# ln -s docker-runc-current docker-runc
# service docker start
# docker volume create portainer_data
# docker pull httpd:2.4-alpine
# service docker stop
================================
======= 스크립트에서 처리 =======
# service docker start
key=`docker run --rm httpd:2.4-alpine htpasswd -nbB admin 12345678 | cut -d ":" -f 2`
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --restart=always portainer/portainer --admin-password "$key"
# DEL_ID=`docker image ls |grep alpine |awk {'print $3'}`
# docker image rm $DEL_ID
# service docker stop
===============================
(항상 구동)
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --restart=always portainer/portainer
--restart=always 옵션을 주면 docker 재시작시 컨테이너가 자동 구동 함
--admin-password 옵션을 주면 초기 패스워드를 설정할 수 있음
docker 를 재구동 할 때마다 패스워드가 초기값으로 돌아가지는 않음
# docker update --admin-password-file /tmp/portainer_password
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer --admin-password '$2y$05$fw/BGmOgoMJbTeh8JBZTieIAqptIu9ofNjIAiMWT7P6/jECJtmHOW'
(잘 됨 : 항상 구동 / hash 패스워드)
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --restart=always portainer/portainer --admin-password '$2y$05$fw/BGmOgoMJbTeh8JBZTieIAqptIu9ofNjIAiMWT7P6/jECJtmHOW'
test
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/portainer_password:/tmp/portainer_password portainer/portainer --admin-password-file /tmp/portainer_password
* 참고
# CTN_ID=`docker container ls |grep portainer |awk {'print $1'}`
docker update --restart=no $CTN_ID
----------------------
[Apache 추가 설치]
# docker pull bitnami/apache:latest
# docker run -d -p 80:80 --name httpd-test httpd
[MySQL 추가 설치]
# docker pull mysql:latest
# MYSQL_USER="mysql_user"
# MYSQL_DATABASE="sample_db"
# MYSQL_CONTAINER_NAME="mysql"
# MYSQL_ROOT_PASSWORD="MY_PASSWORD"
# MYSQL_PASSWORD="MY_PASSWORD"
# docker \
run \
--detach \
--env MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} \
--env MYSQL_USER=${MYSQL_USER} \
--env MYSQL_PASSWORD=${MYSQL_PASSWORD} \
--env MYSQL_DATABASE=${MYSQL_DATABASE} \
--name ${MYSQL_CONTAINER_NAME} \
--publish 3306:3306 \
mysql;
[ubuntu os 설치]
# docker run ubuntu:16.04 //
# docker run --rm -it ubuntu:16.04 /bin/bash
mongodb:27017
# docker hub image list
192.168.10.2:9000
'리눅스 > OS 일반' 카테고리의 다른 글
히스토리에 시간 남기기 (0) | 2018.12.21 |
---|---|
Ubuntu 에서 LSI Mega-Cli 설치, 기본 명령어, Telegram 알람 설정 (0) | 2018.12.18 |
history 시간 출력하기 (0) | 2018.11.14 |
Docker 기본 명령어 및 WEB UI 설치하기 (portainer) - CentOS 7.x (0) | 2018.10.26 |
CentOS 7 에서 FFMpeg 설치하기 (0) | 2018.05.30 |