How to run an already existing public docker container?

I have a really simple question that I can’t seem to find an obvious answer to in the documentation.

Let’s say I want to just run the normal public mongodb image (https://hub.docker.com/_/mongo/) on one of 4 devices I have setup for a particular resin application.

How would I do this? Examples would be great as well, Thanks!

Hey!

What kind of device are you trying to run this on? – Most “normal” images are created for normal desktop computers and their x86 processors, while the devices run on resin.io are mostly ARM devices, so the same program wouldn’t run on that. (Might run on the Intel NUC or the QEMU emulated images).

What you can do most of the time, is to look at their Dockerfile, for example the mongo that you’ve linked and get some inspiration from there to create your own Dockerfile for use. For example the Mongo Dockerfile creates the database at /data and image creation time. That won’t work with resin.io, as that partition is overlayed in our case when the application starts to point to a persistent location outside of the container. Thus the database creation or test needs to be run in a startup script (run within the CMD step in the Dockerfile), and this run whenever the application starts. There are other practical differences too, depending on your application, but this is one of the main ones (handling data persistence). :construction:

Also running on 1 of 4 devices in an application is not really what would be a normal application model. – The application would be the same source code for all the devices, so you’d probably need to think in terms of 2 applications: one with 1 device running your database, and another one with the remaining 3 devices running whatever code you wanna run. :seedling:

This is a lot of info, so let me know if anything’s confusing :slight_smile: