squeakywheel/nginx
Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. Read more on the nginx website.
1.18.0-focal
, 1.18.0
, 1.18-focal
, 1.18
, 1-focal
, 1
, focal
, beta
- /!\ this is a beta releaseamd64
, arm64
, ppc64el
, s390x
$ docker run -d --name nginx -p 8080:80 -e TZ=UTC squeakywheel/nginx:edge
You can now point your browser to http://localhost:8080/ and verify that it works.
Parameters
Parameter | Description |
---|---|
-e TZ=UTC | Timezone. |
-p 8080:80 | Expose Nginx on localhost:8080 . |
-v /path/to/website:/var/www/html | Mount and serve a local website. |
-v /path/to/conf.template:/etc/nginx/templates/conf.template | Mount template files inside /etc/nginx/templates . They will be processed and the results will be placed at /etc/nginx/conf.d . (e.g. listen ${NGINX_PORT}; will generate listen 80; ). |
-v /my/config/nginx.conf:/etc/nginx/nginx.conf | Mount a local configuration nginx.conf (download this example file). |
Testing/Debugging
In case you need to debug what it is happening with the container you can run docker logs <name_of_the_container>
. To get access to an interactive shell run:
$ docker exec -it <name_of_the_container> /bin/bash
You can use your favorite Kubernetes distribution; if you don't have one, consider installing MicroK8s.
With microk8s running, enable the dns
and storage
add-ons:
$ microk8s enable dns storage
$ microk8s kubectl create configmap nginx-config --from-file=nginx=config/nginx.conf
Use the sample deployment yaml provided here. You will also need to download the contents of the html
directory here
# nginx-deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: squeakywheel/nginx:edge
volumeMounts:
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: nginx-config-volume
mountPath: /srv/www/index.html
subPath: index.html
ports:
- containerPort: 80
name: nginx
protocol: TCP
volumes:
- name: nginx-config-volume
configMap:
name: nginx-config
items:
- key: nginx
path: nginx.conf
- key: nginx-site
path: index.html
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
type: NodePort
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 31080
name: nginx
$ microk8s kubectl apply -f nginx-deployment.yml
If you find a bug in our image or want to request a specific feature file a bug here:
https://bugs.launchpad.net/ubuntu-docker-images/+filebug
In the title of the bug add nginx: <reason>
.
Make sure to include:
<tag>
with the one you used to run the image:$ docker images --no-trunc --quiet squeakywheel/nginx:<tag>
docker pull squeakywheel/nginx