Docker를 사용하여 VOLUME 파일 테스트
여기에 docker를 설치하는 것을 보십시오
I will implemt this structure.
Create dockerfile for a volume
Dockerfile
FROM centos:latest
MAINTAINER 0.1 [email protected]
RUN ["mkdir", "/var/log/httpd"]
VOLUME /var/log/httpd
Create imagebash
sudo docker build -t log-volume-image .
check itbash
sudo docker images | grep log
#log-volume-image latest ea4362acfb12 11 minutes ago 193MB
Create dockerfile for ApacheDockerfile
FROM centos
MAINTAINER taro yamada <[email protected]>
# RUN: It executes when it is built
RUN yum -y install httpd
EXPOSE 80
# CMD: It executes when it is running
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
bashsudo docker build -t httpd-image .
check itbash
sudo docker images | grep httpd
#httpd-image latest 8d1d89cb6ce4 34 seconds ago 332MB
start container for logbash
sudo docker run -it --name log-container log-volume-image
start container for httpdbash
sudo docker run -d --name httpd-container \
-p 8080:80 \
--volumes-from log-container httpd-image
start another container for httpd. The difference is just name and port.bash
sudo docker run -d --name httpd-container-2 \
-p 8081:80 \
--volumes-from log-container httpd-image
You can access herebrowser
http://192.168.55.44:8080/
http://192.168.55.44:8081/
check log file. attach containerbash
sudo docker start -ia log-container
You can see a log file by this commandbash
tail -f /var/log/httpd/access_log
You can check also in httpd server.bash
sudo docker exec -it httpd-container /bin/bash
bashtail -f /var/log/httpd/access_log
Reference
이 문제에 관하여(Docker를 사용하여 VOLUME 파일 테스트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/joji/items/4daf3b0a2ecb4d707b0f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)