set up docker and run httpd in 2 vagrant machines. 4

2302 단어 Docker

Run httpd by Dockerfile


create index.html
bash
vi index.html
html
<html>
Hello docker! docker!
</html>
We can run httpd by Dockerfile.
Dockerfile
FROM centos
MAINTAINER taro yamada <[email protected]>
# RUN: It executes when it is built
RUN yum -y install httpd
ADD ./index.html /var/www/html
EXPOSE 80
# CMD: It executes when it is running
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
bash
sudo docker build -t bibobibo/httpd .
You can run docker. host:8080 container:80
bash
sudo docker run -p 8080:80 -d bibobibo/httpd
You can see it from browser.

We can push image to docker index.


please create an account here.
https://hub.docker.com/
bash
sudo docker login
shell-session
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username:
Password: 
Login Succeeded
You can rename image
sudo docker tag "current imagename""docker repository name"
bash
sudo docker tag bibobibo/httpd jojiurano/bibo
bash
sudo docker push jojiurano/bibo
shell-session
The push refers to a repository [docker.io/jojiurano/bibo]
b395726bdce1: Pushed 
6302e3c8d93a: Pushed 
99b28d9413e4: Pushed 
latest: digest: sha256:c39795ad32958fc4475f48099c6965b121f0e6833afa806d390fd9dd4732deec size: 948

앞에 이거.

좋은 웹페이지 즐겨찾기