How to Use Docker & Minio to Create an S3 Clone

Most solutions whether web or mobile are going to have some sort of asset management component to them. The cases can vary but at the end of the day what you need is some sort of flat file storage capabilities. Either for reasons of cost (Azure and AWS S3 hosting can become very expensive very quickly) or industry compliance you may want to store the assets on on-site servers or servers you otherwise control. As is often the case, the open-source community has a solution for you, Minio! Minio is an open-source Amazon S3 compatible flat file storage system that has SDKs in a number of languages (including JavaScript and Java) as well as compatibility with existing AWS libraries for other languages, such as Ruby.

To start, I'm going to assume that you have a server running some form of Linux (my preferred distro is Ubuntu but really any would be fine) and have already installed Docker via your package manager.

The next step is to figure out where you want to store your assets. Depending on your setup, you may or may not need to mount a drive. For the purposes of this tutorial, we'll assume you're using a built-in pre-mounted drive.

You'll need to pull the Minio Docker image like so: docker pull minio/minio. Once that's done you'll want to start the service. The sample command the folks at Minio suggest is: docker run -p 9000:9000 minio/minio server /export, however, that slightly misleading. You actually want to put the path to where you want the images to be store where 'export' is in that command. For example, if you have a /images directory that you want to store the images in you'd amend that command to docker run -p 9000:9000 minio/minio server /images. The '-p 9000:9000' part is just telling Docker what port to run Minio on. That's it! You've got Minio running! A quick tip to modify the command above so you have the output (ie the keys to communicate with Minio from your client application) saved: docker run -p 9000:9000 minio/minio server /images >> minio_out.txt. Be sure to delete the generated file from that command for security purposes.

I hope you've enjoyed this look into Docker and Minio and if you want to know how Buccaneer and I can help you leverage Docker and containerization to take your business or product to the next level, don't miss out on this exclusive blog only offer for a free strategy session.