Docker run Nginx

Docker run Nginx

Run Nginx

1
docker run -d -p 1324:80 --name mynginx nginx

Using Dockerfile Create Nginx & Run Nginx

Creat Docker file

Dockerfile

1
2
FROM nginx
COPY ./index.html /usr/share/nginx/html

index.html

1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p>Hello Nginx</p>
</body>
</html>

build docker imgage

1
docker build -t mynginx:1 .

Run mynginx

1
docker run -d --name mynginx -p 1234:80 mynginx:1

參考