Is it possible to work with Docker-in-Docker on Fly.io?
If you are asking whether you can deploy a docker daemon on fly.io, then the answer is yes. Behind the scenes, we are not running docker containers but firecrackers VMs whose root filesystem we pull out the docker image you deployed then add our own kernel and init process.
Anything you can package an OCI(docker) image, we can run: GitHub - fly-apps/docker-daemon: A Docker daemon to run in Fly and access via a WireGuard peer.
I have a Python/Django application that needs to run third-party Python code and for that I run this code in a container just for it. But in my old hosting the Python/Django app ran in a container inside the server and they didn’t allow creating a container inside another container (Docker-in-Docker).
Here’s an example of what my Python/Django code does:
comando = f'sudo docker compose -f {self.FULL_PATH_DOCKER_COMPOSE} run sandbox python {self.NAME_FILE}'
processo = subprocess.Popen(
comando,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
in Fly.io would this be possible?
Yes that would work if you add docker and docker compose you your app’s image. But I’d recommend you go even further separating your app code from the 3rd party code that you want to run with docker. Because docker is not really a secure sandbox.
Your particular applications sounds well suited for our machines API: Run User Code on Fly Machines · Fly Docs. Instead of shelling out a new process you would call the machine API with instructions on how to run the third party code.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.