Public | Automated Build

Last pushed: 24 days ago
Short Description
Docker image for demonstrating service discovery and consumption in a Swam Mode cluster
Full Description

Tags and respective Dockerfile links

What is this image?

This image is a simple configuration of the Nginx HTTP server, used for demonstrating the provision of a service from a container running on a Docker host, or from containers deployed as service tasks in a Swarm cluster.

How to use this image

Running a container

The content and configuration of Nginx is simplistic, and can be invoked with:

$ docker container run --rm -d -p 80:80 nbrown/nginxhello

To add the hostname of the Docker host to the served content, mount /etc/hostname at /etc/docker-hostname inside the container:

$ docker container run --rm -d -p 80:80 -v /etc/hostname:/etc/docker-hostname:ro nbrown/nginxhello

Running a Swarm service

In order to run a Swarm service, and have each task serve the hostname of the node that the task is scheduled on:

$ docker service create --detach=false \
    --publish published=80,target=80 \
    --mount type=bind,src=/etc/hostname,dst=/etc/docker-hostname,ro \
    nbrown/nginxhello
Docker Pull Command
Owner
nbrown
Source Repository

Comments (0)