httpd on Docker on Vagrant on Windows 10


Git Bash で作業

$ vagrant init
$ vi Vagrant
------------------------------------
config.vm.box = "bento/centos-7.3"

config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "docker.local"
------------------------------------
$ vagrant ssh

以下VM内でのコマンド

$ sudo yum update kernel
$ sudo yum install kernel-devel kernel-headers dkms gcc gcc-c++

$ sudo yum install docker
$ sudo systemctl start docker
$ systemctl status docker.service
$ sudo systemctl start docker.service
$ sudo yum update
$ sudo systemctl start docker
$ sudo yum remove docker docker-common docker-selinux docker-engine
$ sudo yum install yum-utils device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum makecache fast
$ yum list docker-ce --showduplicates | sort -r
$ sudo yum install docker-ce
$ sudo systemctl start docker
$ sudo docker run hello-world
$ sudo systemctl enable docker

$ vi ~/Dockerfile
------------------------------------
FROM centos:centos7
LABEL maintainer "saito"
RUN yum install -y httpd
COPY ./index.html /var/www/html
EXPOSE 80
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
------------------------------------
$ vi ~/index.html
------------------------------------




Docker TEST HTTPD

Docker TEST HTTPD !!!



------------------------------------
$ sudo docker build -t saito/httpd .
$ sudo docker images
$ sudo docker run -p 8080:80 -d saito/httpd

ブラウザで
http://docker.local:8080/