Bf673387320b613a33a0d2a4c0d394a8576c476f
By:
MethodX

Creating and destroying many tiny docker containers

January 31, 2017 478 views
Docker

I'm finishing up work on an app for doing coding challenges. It creates a docker container, runs / unit tests the code and immediately destroys the container. The app works great on my local machine (with docker installed) but I'm having trouble figuring out how this is done in production. It's my understanding that my app will be inside a Docker container, in which case I won't be able to create other containers within that container. I hope this makes sense.

1 Answer

@MethodX

Running Docker on a VPS isn't all that different than running Docker locally. You'd install Docker to the VPS, much like how you installed it locally and then execute your commands as you would to perform the tasks you need to perform.

Personally, I prefer Ubuntu or Debian myself, and the installation guides for it as as follows:

https://docs.docker.com/engine/installation/linux/ubuntu/

https://docs.docker.com/engine/installation/linux/debian/

As for running Docker within Docker, it's doable, but slightly more to manage -- but doable :-).

https://blog.docker.com/2013/09/docker-can-now-run-within-docker/

... and a little more recent reading about why DIND isn't actually needed:

https://github.com/docker/docker/pull/15596

  • @MethodX

    If you're not trying to run Docker within Docker, you can overlook that last part.

    If your app is used to deploy docker containers, it'd be far easier, IMO, to simply setup a working environment -- for instance, NGINX, MySQL, PHP, NodeJS, or whatever you need for your app -- then install Docker and run your app on the host machine and simply create your containers as normal.

    To use Docker, you don't have to run your app from within a container. You can run your app on the main server and still use Docker too.

Have another answer? Share your knowledge.