본문 바로가기

클라우드/도커(Docker)

도커 Docker Wordpress 인프라 구축

 

 환경변수 확인

https://hub.docker.com/_/mysql

 

mysql

We and third parties use cookies or similar technologies ("Cookies") as described below to collect and process personal data, such as your IP address or browser information. You can learn more about how this site uses Cookies by reading our privacy policy

hub.docker.com

 

https://hub.docker.com/_/wordpress

 

wordpress

Get more out of Docker with a free Docker ID Sign up for a Docker ID to gain access to all the free features Docker has to offer, including unlimited public repositories, increased container image requests, automated builds, and much more. Sign Up ✕

hub.docker.com

 

 


 

더보기

# 도커 볼륨 생성
vagrant@docker:~$ sudo docker volume create wpdb
vagrant@docker:~$ sudo docker volume create wpweb

# db 서버 컨테이너 생성
root@docker:~# docker run -d -v wpdb:/var/lib/mysql \
> -e MYSQL_ROOT_PASSWORD=1234 \
> -e MYSQL_DATABASE=wordpress \
> -e MYSQL_USER=ldh \
> -e MYSQL_PASSWORD=qwer1234 \
> --name wpdb mysql:5.7

# web서버 컨테이너 생성
root@docker:~# docker run -v wpweb:/var/www/html \
> -e WORDPRESS_DB_HOST=wpdb \
> -e WORDPRESS_DB_NAME=wordpress \
> -e WORDPRESS_DB_USER=ldh \
> -e WORDPRESS_DB_PASSWORD=qwer1234 \
> --link wpdb:wpdb \
> -p 80:80 \
> -d --name wpweb wordpress:5.7.2


# 워드프레스 wordpress, mysql
# 환경설정 파일이 없어도 환경변수로 정보를 설정할수있다
 ex -e WORDPRESS_DB_HOST=...
    -e WORDPRESS_DB_USER=...
    -e WORDPRESS_DB_PASSWORD=...
    -e WORDPRESS_DB_NAME=...