We have a Portainer server running at https://portainer.uwcs.co.uk, which provides a convenient web interface for deploying docker containers. Our container host is set up to run services deployed using Portainer.
Log in to portainer using your UWCS account. You should be presented with a screen that shows you a single Portainer environment, 'UWCS Public Docker'. Within that envionment you can see all of your containers, volumes, etc on that host.
Go to containers and click '+ New Container' in the top right. You'll be presented with a screen that allows you to enter the container image name to start, and configure options such as exposed ports, mount points, environment variables, etc. Fill in the options and click 'Deploy the Container' to start the service.
Your service will now continue to run until it either crashes or you stop it. You can inspect the state of the running container by clicking on 'logs' to see it's output, or start a new shell within it by clicking 'console'.
See https://docs.portainer.io/user/docker for full documentation on how to work within portainer, including adding a new container. Always read the docs first!
By configuring your container in a specific way, you can expose ports to the internet on a
*.containers.uwcs.co.uk subdomain. Our Nginx proxy will re-configure itself to reverse-proxy incoming HTTP traffic to your service.
Add an environment variable
VIRTUAL_HOST=foo when deploying your container in portainer, and publish the port within your container to a random port on the host. Any HTTP requests to
foo.containers.uwcs.co.uk will now be forwarded to that port on your container.
If you try to deploy and get an error, then you're probably using a port that's already in use: try a different one. Another common issue is requests to your container being randomly redirected to someone else's container, which occurs when there are multiple containers with
VIRTUAL_HOST set to the same value, which causes nginx to load-balance between your containers. This can be resolved by changing your hostname.
The service that does this is documented fully in the README of https://hub.docker.com/r/nginxproxy/nginx-proxy. See there for more info about configuring the proxy, for example setting
Note that this only works for HTTP traffic (layer 7), which is fine for 90% of use cases. If you have a service that requires a TCP (layer 4) proxy or another port-forwarding configuration, then get in contact with us and we can configure it manually.
If you just need to temporarily access a service running on the container host, you can forward the port through Hopper. Make sure the port is manually published, and then run the following to open an SSH tunnel.
ssh -L <local port>:public-docker.internal.uwcs.co.uk:<internal port> uwcs.co.uk
This is useful if you, for example, want to access a database running on there to use during development.
If you are looking to host a fairly common application (eg. games servers), you will likely be able to find a pre-made docker container for it on Docker hub, which will save you the hassle of writing one yourself.
We ran a workshop on writing a containerised service using Docker, GitHub Actions and Flask: https://uwcs.co.uk/resources/docker. The full code from that workshop can be found here as a template repo at https://github.com/uwcs/flask-service, which you can use as a starting point for your own HTTP-based services in Python. This kind of setup using actions, ghcr and portainer is very good, and mirrors what is commonly used within industry.
Discord bots are also a good candidate for containerisation and can be easily hosted with our services. See https://github.com/uwcs/apollo for our Discord bot as an example, or https://github.com/uwcs/discord-bot as a template repo for writing your own.
For other languages and kinds of applications, there plenty of examples and tutorials online. Alternatively, feel free to ask our community of experts in Discord.
ghrc.io/, as portainer will otherwise assume you mean docker hub
docker-composefiles within Portainer