
Remotion - Docker build
Building , Breaking, Fixing, Learning.. A bit all over the place but it will get better.
UPDATE:18.Sept.2015. I would not reccomend using this resource as a guide to Remotion-Docker installation. As I learn I have to
update too and when doing so I realize how clueless I was first time round.
I would dub this post " Cowboy Style" Follow this link for the updated docker build post - Best Practices Applied
One of my biggest spends in my working video pipeline is the video stitcher "Creatomate," clocking in at $45 USD per month. Now, look, it's an awesome service, and I love it, but with my content not generating income yet, it's quite a fast drain on funds.
Initially, I had FFCreator https://github.com/tnfe/FFCreator lined up to be the solution. I had it almost working. Text rendering was quite an issue, and then it broke, and no matter what I did, I just, for the life of me... Well, let's just say I kind of threw it out after the seventh day of building non-running containers. Perhaps it is me, but I decided to go the Remotion route. https://www.remotion.dev/ - https://github.com/remotion-dev/remotion
Now, on my second day with Remotion, I decided to log my progress; otherwise, it just feels like I'm breaking things, and nothing is happening, almost like time is wasting without passing. So, here is what I have faced so far.
Keep in mind I know nothing about Remotion. I just figured it would be able to do what I want it to do.
Building on Ubuntu with Docker V27+
Below is my initial tree view the main docker file is in the main Root is one level up. This is the persistent data location. No templates yet Just trying to get it to run (HEALTHY) first.

Initial Parse Error
Encountered This Error: I started with a build error showing "unknown instruction: set" due to heredoc syntax issues in the Dockerfiles, causing a parse failure.
Solution: I enabled DOCKER_BUILDKIT=1 and extracted the scripts into separate files to resolve VSCode compatibility and Dockerfile parsing issues.
Rebuild and Run: I rebuilt the containers with DOCKER_BUILDKIT=1 docker compose build --no-cache remotion-studio remotion-render-worker and ran them with docker compose up -d.
GID Conflict
Encountered This Error: During the build, I faced groupadd: GID '1000' already exists because the base image's node user clashed with my remotion user.
Solution: I changed the UID/GID to 1001 for the remotion user to avoid the conflict.
Rebuild and Run: I rebuilt with the updated Dockerfiles and restarted the containers.
NPM CI Failure
Encountered This Error: I encountered an npm ci failure with "The npm ci command can only install with an existing package-lock.json," halting the dependency installation.
Solution: I replaced npm ci with npm install --omit=dev in the Dockerfile to proceed without requiring a lockfile.
Rebuild and Run: I rebuilt the containers and verified the installation succeeded.
Missing package.json
Encountered This Error: The build failed with ENOENT: no such file or directory, open '/app/package.json' because the file wasn’t in the build context.
Solution: I placed package.json in ~/n8n-ai-studio/persistent-data/remotion/ to match the build context.
Rebuild and Run: I rebuilt and confirmed the build proceeded.
Missing render-worker.js and start-worker.sh
Encountered This Error: The build failed with "failed to compute cache key" due to missing render-worker.js and start-worker.sh in the context.
Solution: I created and placed these files in the context directory, providing their contents.
Rebuild and Run: I rebuilt the containers and started them to test.
CMD Execution Error (Studio)
Encountered This Error: The remotion-studio container restarted with Cannot find module '/app/start-remotion.sh', as Node misinterpreted the bash script.
Solution: I updated the CMD to ["/bin/bash", "/app/start-remotion.sh"] in Dockerfile.remotion-studio.
Rebuild and Run: I rebuilt and ran the studio container, verifying startup.
Volume Overwrite Issue
Encountered This Error: Scripts were missing at runtime due to the volume mount ./persistent-data/remotion/projects:/app:rw overwriting /app/.
Solution: I moved start-remotion.sh and start-worker.sh to projects/ and adjusted the mount to /app/projects.
Rebuild and Run: I rebuilt and restarted the containers.
CMD Execution Error (Worker)
Encountered This Error: The remotion-render-worker container restarted with Cannot find module '/app/start-worker.sh', mirroring the studio issue.
Solution: I updated the CMD to ["/bin/bash", "/app/start-worker.sh"] (later adjusted to /app/projects/ with the mount change).
Rebuild and Run: I rebuilt and ran the worker container.
Dangling Images Cleanup
Encountered This Error: I noticed accumulated dangling images (e.g., 914337808cbd, a917215e4eba) from failed builds, cluttering storage.
Solution: I cleared them with docker image prune -f and removed specific exited containers (docker rm -f f0de26ae4f74, docker rm -f 0a42ed07f6c5).
Rebuild and Run: I rebuilt and started all containers post-cleanup.
NPM Executable Not Found
Encountered This Error: The containers restarted with npx remotion --version failing due to node_modules being overwritten by the volume.
Solution: I initially added npm install --omit=dev to start-*.sh scripts for runtime install, then shifted to adjusting mounts to preserve deps.
Rebuild and Run: I rebuilt with mount changes and restarted to test.
Still Restarting (Volume Mismatch)
This Was the Issue Discovered: After mount adjustments, containers still restarted because start-*.sh paths didn’t match the new /app/projects/ location.
This Was the Solution: I updated Dockerfiles to copy scripts to /app/projects/ and adjusted CMD to /app/projects/start-*.sh.
Rebuild and Run: I rebuilt and ran the containers to verify.
This log tracks my effort—multiple rebuilds, container restarts, and cleanups—culminating in a stable setup. Let’s check the latest logs to confirm resolution!
12. Volume paths Adjusted incorrectly
What happened? The persistent data location was just mapped incorrectly to find the startup script.
This Was the Solution:I had to make sure I updated all the required paths and I had one destination nested instead of root. Simple user error probably because it was late night.
Rebuild and Run: Verifying now
Still Restarting -
What happened? (Studio - Container )
The npx remotion studio command in start-remotion.sh loads remotion.config.ts to apply runtime settings. When it evaluates Config.setBrowser("chrome-for-testing"), the CLI throws a TypeError because the method doesn’t exist, crashing the process. This halts the studio startup, leading to the restart loop.This Was the Solution:
Remove Invalid Method: Delete Config.setBrowser("chrome-for-testing"); since it’s unnecessary—your REMOTION_CHROME_MODE=chrome-for-testing ENV in the Dockerfile already sets the mode.
AndWhat happened? (Render Worker - Container )
Abrupt End: The log stops after listing CLI commands, suggesting start-worker.sh completes its verification steps but fails to transition to exec node render-worker.js or the Express server crashes.
-Possible Causes:Script Exit: If an error in start-worker.sh (e.g., after npx remotion --version) prevents exec node render-worker.js, the container stops.
render-worker.js Failure: The Express server might fail to start (e.g., due to src/index.ts issues or config errors) and exit without logging.
Health Check: The HEALTHCHECK (curl http://localhost:3002/health) might fail if the server doesn’t start, triggering restarts.
What solution was tried:
Verify Script Flow: Check start-worker.sh to ensure exec node render-worker.js is reached and doesn’t fail silently.Test render-worker.js: Confirm the Express server starts and listens on port 3002
Outcome: Turns out these files are corrupted and only half of the code is in each. (unsure how tf that happened. so rewriting and then will re-deploy, and rebuild
Remotion studio container Build fail.
The issue
=> ERROR [remotion-studio 7/10] RUN npm install --omit=dev && npm install @remotion/bundler @remotion/renderer @remotion/cli && npx re 7.4s
Rebuilding again, fingers crossed.
Hey, so we've been through quite the adventure getting this Remotion setup humming in Docker, haven't we? It started with those pesky parse errors from heredoc syntax in the Dockerfiles, which had us enabling BuildKit and pulling scripts out into separate files to keep VSCode happy. From there, it snowballed into GID conflicts with the base Node image, NPM CI hiccups without a lockfile (switched to npm install --omit=dev), missing files like package.json and render-worker.js, and CMD execution mishaps where Node tried to load bash scripts as modules. We tackled volume overwrites that wiped out our deps at runtime, config TypeErrors from invalid Remotion API calls like setChromiumFlags, and even dangling images cluttering space. Each time, we'd research the docs and forums, assume a role like Docker Storage Manager or Remotion Configuration Validator, discuss the root cause, and fix it step by step—cleaning up containers, pruning junk, and rebuilding with --no-cache to test.Our approach was all about steady, methodical progress: verify the error, pinpoint the mismatch (like source paths or mounts), make minimal changes, and iterate with rebuilds and logs. We avoided overhauling everything at once, instead focusing on one issue—like adjusting mounts to /app/projects to preserve node_modules—and confirming with docker compose logs before moving on. Now, with the config cleaned up and scripts aligned, we're in the rebuilding phase: docker compose down to clear the old containers, DOCKER_BUILDKIT=1 docker compose build --no-cache for fresh images, and docker compose up -d to spin them up.
Rebuilt the containers again . Still restarting. The issue now.
Did We Make Progress?:Yes, we resolved earlier issues (e.g., duplicate RemotionRoot, initial setBrowser error) and rebuilt successfully. The logs show dependency installs and initialization, indicating the build process improved. However, runtime errors persist due to overlooked config and path fixes.
What’s the Issue Now?:
remotion-studio:
Error: TypeError: import_config.Config.setChromiumFlags is not a function at line 7:22 in remotion.config.ts. The invalid method call crashes npx remotion studio.
Cause: The remotion.config.ts edit to remove setChromiumFlags wasn’t applied or reverted. The logs reflect the old version.
remotion-render-worker:
Error: render-worker.js not found during verification in start-worker.sh. The script checks /app/render-worker.js, but the file is copied to /app/projects/ in the Dockerfile.
Cause: A path mismatch—start-worker.sh looks in the wrong directory due to an outdated check.
What Needs to Happen:Studio: Remove setChromiumFlags from remotion.config.ts and rebuild.
Worker: Update start-worker.sh to check /app/projects/render-worker.js.
Stopped current running containers , removed them and now again
Rebuilding.
Studio container:
DOCKER_BUILDKIT=1 docker compose build --no-cache remotion-studio
Render-worker container:
DOCKER_BUILDKIT=1 docker compose build --no-cache remotion-render-workerFingers crossed for a successful startup nr 17
Got the container built with no issues, ad remotion running no issues. CPU only
But the setup is a bit non standard. Working on the next iteration.
See the build with best practices applied