docker exec -it a55f471ce41b bash
apt update
apt-get install vim
vi /etc/apache2/ports.conf
vi 로 index.html 바꿔보고 1.3컨테이너에 보내본다.
tar cvf test.tar images index.html
FROM nginx:latest
ADD test.tar /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
여기 이미지 만들때는 foreground 사용할겠따고 하고 밖에서 run을 할떄 background 사용한다고 ㄱㄱ
docker build -t test_build:2.0 .
뒤에 . 찍으면 Dockerfile
docker inspect nginx:latest
index.html -> blue로 바꾸고
FROM nginx:latest
ADD test1.tar /usr/share/nginx/html
test.tar -> test1.tar로 바꾸고
vi Dockerfile 해서 이번에는 3번째 줄을 지움
tar cvf test1.tar images index.html
docker build -t test_build:v1.0 .
docker login
docker tag test_build:v1.0 eeapbh/test_build:v1.0 # 도커 푸쉬할라면 태그작업해줘야함
docker push eeapbh/test_build:v1.0
docker tag test_build:v2.0 eeapbh/test_build:v2.0
docker push eeapbh/test_build:v2.0
sudo apt install docker-ce -y
sudo usermod -a -G docker ubuntu
exit
docker run -d -P --restart always eeapbh/test_build:v1.0
docker run -d -P --restart always eeapbh/test_build:v2.0
# 도커 호스트가 실행이 되면 자동으로 컨테이너가 올라가도록 restart 옵션 + always 추가
docker ps
포트확인하고 들가보면 잘들어가짐
vi index.html
# 색이랑 h1태그 수정
tar cvf test2.tar images index.html
vi Dockerfile
FROM nginx:latest
ADD test2.tar /usr/share/nginx/html
docker build -t eeapbh/test_build:v3.0 .
docker push eeapbh/test_build:v3.0
docker inspect centos:7
# mkdir wordpress && cd $_
# vi Dockerfile
FROM centos:7
MAINTAINER itssp0405@gmail.com
RUN yum install -y httpd php php-mysql php-gd php-mbstring wget unzip
RUN wget https://ko.wordpress.org/wordpress-4.8.2-ko_KR.zip
WORKDIR /var/www/html
RUN unzip /wordpress-4.8.2-ko_KR.zip
RUN mv wordpress/* .
RUN chown -R apache:apache /var/www
EXPOSE 80
CMD httpd -DFOREGROUND
docker network create test_network # 그냥 아무렇게나 네트워크 만듬
docker network ls
docker inspect test_network
docker run -d -p 3306:3306 --name dbserver \
-e MYSQL_DATABASE=wordpress \
-e MYSQL_USER=wpuser \
-e MYSQL_PASSWORD=wppass \
-e MYSQL_ROOT_PASSWORD=password --network test_network mariadb
docker run -d -p 80:80 --name wordpress --network test_network eeapbh/my-wp:v1.0
mariadb가 지금 test_network에 있으니까 , dns도 쓸..고
centos vm 만들고 도커 설치
mkdir volume && cd $_
mkdir bm01 ; touch bm01/test.txt
ls bm01
docker run -itd --name bm-test -v /root/volume/bm01:/mnt centos:7
# 왼쪽은 도커 호스트 볼륨 오른쪽은 /mnt 폴더
docker exec bm-test ls /mnt
docker volume create my-vol01
docker volume ls
docker volume inspect my-vol01
ls /var/lib/docker/volumes/my-vol01/_data
docker run -itd --name vol-test -v my-vol01:/mnt centos:7
docker container run -itd -p 801:80 --name vol-web -v my-vol01:/usr/local/apache2/htdocs:ro httpd:latest
curl 192.168.0.156801
docker container exec vol-test sh -c "echo "Nihao" > /mnt/index.html"
docker network create gcp-network
docker network inspect gcp-network
docker run -d -p 3306:3306 --name dbserver \
-e MYSQL_DATABASE=wordpress \
-e MYSQL_USER=wpuser \
-e MYSQL_PASSWORD=wppass \
-e MYSQL_ROOT_PASSWORD=password --network gcp-network mariadb
docker run -d -p 80:80 --name wordpress --network gcp-network eeapbh/my-wp:v1.0
aws route 53만들어서 연결
docker commit -a "bonghyeon" -m "dbserver" dbserver eeapbh/gcp-dbserver:tiger
docker commit -a "bonghyeon" -m "dbserver" dbserver eeapbh/gcp-wordpress:eagle
docker images
docker push eeapbh/gcp-dbserver:tiger
docker push eeapbh/gcp-wordpress:eagle
docker rm -f $(docker ps -a -q)
docker rmi -f $(docker images -q)
docker run -d -p 3306:3306 --name dbserver --network gcp-network eeapbh/gcp-dbserver:tiger
docker run -d -p 80:80 --name wordpress --network gcp-network eeapbh/gcp-wordpress:eagle
cd ~
mkdir onbuild && cd $_
# vi Dockerfile.base
FROM ubuntu:18.04
RUN sed -i 's/archive.ubuntu.com/ftp.daumkakao.com/g' /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get -y install nginx
EXPOSE 80
ONBUILD ADD website*.tar /var/www/html/
CMD ["nginx", "-g", "daemon off;"]
# docker build -t eeapbh/web-base:v1.0 -f Dockerfile.base .
# docker inspect eeapbh/web-base:v1.0
# docker login
# docker push eeapbh/web-base:v1.0
# vi Dockerfile
FROM halilinux/web-base:v2.0