Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Additional notes

Original blog post -

How do I rebuild the image from scratch?

This will take several hours on a Raspberry Pi Zero - but less time on a Pi 2 or Pi 3. You can edit the Dockerfile for a Pi 2/3 and change RUN make to RUN make -j 4 to take advantage of the quad-core processor.

$ git clone
$ cd streaming
$ docker build -t alexellis2/streaming .

How do I edit the settings?

You should edit the file and then write a new Dockerfile using my image as a base:

Place a Dockerfile in a new directory with this contents:

FROM alexellis2/streaming:17-5-2017

Then run a Docker build - this should take less than 10 seconds since we're only adding on top of the existing image.

$ cd streaming
$ docker build -t alexellis2/streaming .

How can I enter bash on the container?

You can replace the start-up command (ENTRYPOINT) like this:

$ docker run --entrypoint=/bin/bash --privileged --name cam -ti alexellis2/streaming:17-5-2017
Copy link

Baenwort commented Jan 3, 2020

The original post by @alexellis was super easy to follow and implement, with great instructions. The same cannot be said for the instructions for modifying the settings in the file. I'm a part time, google search educated coder, with a barely moderate skill for navigating my way around a unix environment and fell for the easy guide in the original post. The instructions above on how to create a new image with your own modified file however, leaves a lot to be desired for the average Joe, and took me a significant amount of time to figure out and get working. TBH, I'm not sure my method worked, but I was able to get it working without spitting errors at me and starting streaming content. So, for the layman, here are my step by step instructions (I do this via SSH on a Mac in Terminal):

Make sure you're in your user root, type and enter:

Make a new directory, type and enter:
mkdir streaming

Go to the new directory:
cd streaming

Now we're going to create two files and populate them. Let's start with the Docker file.
sudo nano Dockerfile

Copy this and paste it into the file:

FROM alexellis2/streaming:07-05-2018
RUN chmod +x

Note: I'm running Raspbian Stretch, so my first line contains alexellis2/streaming:07-05-2018. If you're running Jessie, use alexellis2/streaming:17-5-2017 instead.

Press Ctrl-x to exit and save the file.

Now create the file (we're still in the streaming directory for all this, btw).
sudo nano

Copy the contents from the original file here, and paste it into the new file.

The new file is where you'll make your settings changes for display size, frame rate, bit rate, etc.
When you're done making the changes, press Ctrl-x to exit and save the file.

NOW, we can build the new image using the new settings:
docker build -t alexellis2/streaming .

This should only take a few seconds. Now we can run the docker file again, making sure as @graemecoates pointed out to add the latest tag to your command. Here's what mine looks like:
docker run --privileged --name cam -ti alexellis2/streaming:latest xxxx-xxxx-xxxx-xxxx

Replacing of course the xxxx's with your own Youtube stream key.

When you need to tweak your settings, modify your file again using sudo nano, and run the docker build... command again.

Now, if you 'sperts out there think I did something wrong, I would love to hear it as I'm still learning!

This worked well for me and explained things very well. The only thing I would add is that you can tag your docker images you create with the build command so that if you need to roll back after a experiment it is easier to do instead of using latest.

You can accomplish this by using the command:
docker tag IMAGE ID alexellis2/streaming:VERSION

Where IMAGE ID is the number from the column of that label shown when you run the command:
docker image ls

Where VERSION is a unique name you can remember and use in place of latest in your run command. This lets you return to older ideas or roll back if you mess something up to a version you know worked.

Copy link

Just seen these comments. Harsh. If you want to ask for something, you know how to get in touch. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment