Hosting browser games on your Pi

You don't need a license to drive Nginx

I have prepared another Docker container for the Raspberry Pi 3, this time it’s a Nginx 1.13.1 with Alpine 3.6 ready to be used.

I have used as reference the official Dockerfile from Nginx and this Dockerfile from @smebberson, you can see the final result in my repository here, the size of this image is 25MB :), also you can get a copy as usual

sudo docker run --rm -it --name nginx-server -p 80:80 kafebob/rpi-alpine-nginx

With this image I have learned to use another of the Docker killers features, data volumes.

Data volumes are designed to persist data, independent of the container’s lifecycle. Docker therefore never automatically deletes volumes when you remove a container. You can add a data volume to a container using the -v flag when you run a container. You could also use the -v multiple times to mount multiple data volumes.

This means that we can have information outside the container and make it available using appropriate settings. As a software engineer this is fantastic, since you can have a whole development environment ready in a matter of minutes without having to install or to configure anything on your host.


As an example, see how straightforward it would be to use this container to serve browser games.

Step 1. Choose your game(s)

In you can find an awesome list with open source games for the browser.

I’m going to use Survivor game and I’ll save it in the folder games.

mkdir ~/games && cd $_ && \
git clone

Step 2. Load Nginx Container

Once you have downloaded all the games you want, it’s time to start a Nginx container just like this

sudo docker run --rm --name browser-games-box -v ~/games:/var/www -p 80:80 kafebob/rpi-alpine-nginx

Notice flag -v ~/games:/var/www which tells docker that folder ~/games that we have recently created will point
to /var/www folder inside the container.

Step 3. Have fun and play

Open a browser and type the IP of your Pi. In my case, the IP is so then url is

If you don’t know the IP of your Raspberry, in the article Docker & Raspberry Pi, perfect combo! is explained here how you could find the ip.

And it’s done, you will see in your browser a folder list with the games you’ve copied in folder ~/games. You can add more games if you like, the Nginx container will see all the changes immediately.

List of games Survivor

Nginx Image Extra

This Nginx image exposes also the folder /etc/nginx/conf.d as a data volume, which means you can provide your custom server configuration (enable ssl, change error page location, etc.). The following command example will create a container and will mount as well nginx configuration folder.

sudo docker run --rm --name browser-games-box -v ~/games:/var/www \
-v ~/custom-nginx-conf:/etc/nginx/conf.d -p 80:80 kafebob/rpi-alpine-nginx

In ~/custom-nginx-conf folder save your custom nginx server configuration.

Any question?, leave your comments below.

Happy coding!