LoginSignup
0
1

More than 5 years have passed since last update.

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

Last updated at Posted at 2017-08-02

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 <taro.yamada@bibo.com.ph>
# 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.
スクリーンショット 2017-08-03 18.41.54.png

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

スクリーンショット 2017-08-02 18.38.30.png

前はこちら

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1