A simple config for nginx on ubuntu system.
There are some methods to use this image.
$ docker run --name [my-nginx] -d xqdocker/ubuntu-nginx
$ docker run --name [my-nginx] -v /my/static/content:/data/www -d xqdocker/ubuntu-nginx
$ docker run --name [my-nginx] -p 8080:80 -d xqdocker/ubuntu-nginx
Then you can access http://localhost:8080 or http://host-ip:8080 in your browser.
$ docker run --name [my-nginx] -v /my/nginx.conf:/etc/nginx/nginx.conf:ro -d xqdocker/ubuntu-nginx
:ro It's define this directory is read-only in container.
Step one: Create a simple Dockerfile like the following:
FROM xqdocker/ubuntu-nginx
COPY /my/static/content /data/www
COPY /my/nginx.conf /etc/nginx/nginx.conf
COPY /my/conf.d/default.conf /etc/nginx/conf.d/default.conf
Step two: Build the docker image with this Dockerfile.
$ docker build -t [my-ubuntu-nginx] .
Run the docker image with the following command:
$ docker run --name [my-nginx] -d [my-ubuntu-nginx]
Step one: Create a simple docker-compose.yml file:
my-nginx:
image: ubuntu-nginx
volumes:
- /my/static/content:/data/www
- /my/nginx.conf:/etc/nginx/nginx.conf
- /my/conf.d/default.conf:/etc/nginx/conf.d/default.conf
ports:
- "8080:80"
environment:
- NGINX_HOST=example.com
- NGINX_PORT=80
command: /bin/bash -c "nginx -g 'daemon off;'"
Step two: Build and run this docker-compose.yml with Docker-Compose command.
$ docker-compose run my-nginx
Code is under the MIT license.
Content type
Image
Digest
Size
83.5 MB
Last updated
over 9 years ago
docker pull xqdocker/ubuntu-nginx