Docker specific instructions
There are differences between running Docker on Linux, Mac and Windows.
Linux can share the host network using --network=host
Mac and Windows need port publishing using --publish HOST_PORT:CONTAINER_PORT
. This makes using the ephermeral range for UDP protocols harder.
The default --shm-size
for Docker is 64MB, which is barely enough to do anything for MistServer, please do not forget to set this value!
It's recommended to set a good amount of RAM depending on your hardware. We recommend using 95% if this is a dedicated server. Otherwise we would recommend at least 50% of your RAM. In the interest of keeping this quick and simple the --shm-size=###
flag has been set to use 1GB of your RAM.
Set up the following values!
--network=host
To bind MistServer to the host network, allowing others to connect--publish HOST_PORT:CONTAINER_PORT
As alternative to--network=host
, required for Mac/Window users/PATH/TO/CONFIG.JSON
Host location where you want to store the MistServer configuration./FOLDER/WITH/VIDEOFILES
Host location where VoD content is available1g
Amount of shared memory available to the docker image
docker run --detach --mount type=bind,source=/PATH/TO/CONFIG.JSON,destination=/config.json --mount type=bind,source=/FOLDER/WITH/VIDEOFILES,destination=/video --shm-size=1G --network=host ddvtech/mistserver
For more details on which docker images are available visit our official dockerhub page Keep in mind that some of our Docker images are just the MistServer binaries, while it will make the image itself super lightweight it does not allow for adding applications or running scripts within the Docker itself. Should you need an OS we recommend grabbing one of the images with an OS included or building your own version.
Docker works great with MistServer, however there is one technical limitation. Docker's default network set up will significantly impact the performance of network operations. We do not recommend running intense loads on this configuration. Please use bare metal instead! If you stay within ~50% of your network capabilities you will not notice any impact however.
- Docker Compose
- Docker Desktop
- Docker run
- Docker build
In the examples below we will be using the ddvtech/mistserver_alpine_minimal
container, make your own adjustments accordingly.
Minimal Docker compose.yml using --network=host
services:
mistserver:
image: ddvtech/mistserver_alpine_minimal
container_name: mistserver
shm_size: '1gb'
network_mode: 'host'
restart: always
Minimal Docker compose.yml using --publish
services:
mistserver:
image: ddvtech/mistserver_alpine_minimal
container_name: mistserver
shm_size: '1gb'
ports:
- 8080:8080
- 443:443
- 4242:4242
- 8889:8889/udp
- 5554:5554
- 4200:4200
restart: always
MistServer requires the --shm-size
value set, which unfortunately is impossible directly from running a container using purely Docker Desktop. You will need to run a manual Docker command, but once done you can use Docker Desktop as usual from there on.
Grabbing the image
All our images will come from ddvtech
, there could obviously be more available within Dockerhub. Feel free to pick any you like, however we obviously cannot give support/guarantees on images not from us.
Getting the docker run command
MistServer will require a --shm-size=SIZE
flag, however shared memory cannot be set using an environment variable, it must be done through a docker run command. This means we cannot avoid running it through the terminal or power shell. However Docker Desktop will pass on all required settings except for --shm-size
if you start setting it up.
First boot through Docker Desktop To get the Docker run command we first boot it up, we then can set up the environment parameters. If you're running on Windows/Mac you will need to configure all the ports you will want to use from the outside. We have provided our defaults, but feel free to change/add ports as you like.
Copy the Docker Run command Once set up, we will need to copy the docker run command and edit this.
Edit docker run
to include --shm-size
Now open your terminal and paste the docker run command
We will need to add the --shm-size=SIZE
setting. This is the amount of RAM available to MistServer to use, if you're only interested in testing MistServer with a few streams 1G
is plenty. A good rule of thumb is to take bitrate
times stream buffer
+ 20%. Our default stream buffer
is 50 seconds.
Keep in mind you cannot go over your maximum RAM for this setting, if you want to use the maximum available the LOG of the container currently running will give you a number to copy in the first few lines.
It does not matter where you set the
--shm-size=SIZE
in thedocker run
command, we've set it before the-d ddvtech:mistserver/3.4
flag and set it to4G
to allow for some more streams.
Delete previous container and execute docker run
You can now delete the currently running container, you will no longer need it and it is blocking the ports you will want to use.
Run the command and you will now have an extra container You can now start testing MistServer! .
Docker run is the most basic method of starting a Docker container. A very minimal docker run
script would be can be found here:
Docker run bare minimum sharing host network
docker run --shm-size=1G --network=host ddvtech/mistserver_alpine_minimal:latest
**Docker run bare minimum publishing ports
docker run --shm-size=1G -p 8080:8080 -p 4242:4242 -p 4200:4200 -p 5444:5444 -p 8889:8889/udp -p 443:443 ddvtech/mistserver_alpine_minimal:latest
We've noticed that most people tend to prefer to test a container quickly, if that is the case we recommend adding the following flags --rm -ti
to both destroy the container once shut down & allow the terminal to be used by the Docker image.
Single run Docker container using host network
docker run --shm-size=1G --network=host --rm -ti ddvtech/mistserver_alpine_minimal:latest
Single run Docker container publishing default ports
docker run --shm-size=1G -p 8080:8080 -p 4242:4242 -p 4200:4200 -p 5444:5444 -p 8889:8889/udp -p 443:443 --rm -ti ddvtech/mistserver_alpine_minimal:latest
Single run Docker images will NOT save settings between uses unless the configurations are stored outside Docker containers
Creating your own Docker container
Adding MistServer to your own Docker images is quite easy. Adding the binaries from the Docker image would run on any docker image. You can also choose to compile MistServer if you are creating a Docker image with a distro.
An Ubuntu 22.04 bare minimum Dockerfile
would look like this:
FROM ubuntu:22.04
RUN apt-get -y update && apt-get -y install build-essential git python3-pip
RUN python3 -m pip install meson ninja
RUN git clone https://github.com/DDVTECH/mistserver.git
RUN cd mistserver && git checkout development && meson setup build --default-library static && cd build && ninja install
CMD MistController -c /etc/mistserver.conf
If you're building your own Dockers there's a good chance you know what you want configured. However keep in mind that you still need to give your Docker enough shared memory to work with.
Do not forget to add --shm-size=SIZE
and either --network=host
or --publish HOST_PORT:CONTAINER_PORT
to your docker run command. We recommend at least 1gb
for minimal testing.