New to Docker? Try it out for free!
Interaction Designs
Posted on April 20, 2022
Docker is a powerful tool used to for containerization of microservices. This provides a quick way to spin up sections of an application or website that are needed at the time and spin them down after their function is served. This process saves server space, money, and makes it easier for pushing updates and fixes to a part of the project without breaking the whole thing.
The Good and Bad
Downside... the full power of Docker costs money. But you are able to use a free virtual server on Play with Docker to sharpen your skills, test out projects or just learn how it all works.
Try it Out
If you click the link above, you'll be brought to Docker's free service where you get the full experience of Docker for 4 hours at a time.
I'm going to show deploying a project on Github named HAXcms. HAXcms is a next-gen content management system fully built out of the open source project HAX (Headless Authoring eXperience).
Steps
- Click the "Login" button on Play with Docker's homepage, and either login or create a new account (don't worry it's free). Once you're logged in, hit the "Start" button and you will be brought to a page that looks like this:
From here you want to click the "+Add New Instance" button, which will spin up a virtual server for you to run your project on.
Now since we've started an instance we can begin running commands to build and run our project. Start by cloning the HAXcms project into your instance by clicking in the black box, typing
git clone https://github.com/elmsln/HAXcms.git
, then hit 'Enter'.
You'll see the progress of the project being cloned into your environment.Once it's done cloning, let's navigate to that folder with
cd HAXcms
.Now we're going to build an image of the project. We do this by running
docker build . -t haxcms
.docker build
is our command to run the build,.
selects the files in our project and-t haxcms
declares the name of the image we're making.Once your image is built, we're ready to run the project in our container! Run
docker run -dp 80:80 haxcms
and you'll notice a blue "80" link shows up next to the "Open Port" button.
Click that link and a new tab will open with the running project on your computer.
You're all set!
That's the basics to getting a project running with Play with Docker. If you'd like to run your own project or another project you've found, you can follow the same steps and replace the HAXcms areas with any project you'd like.
Posted on April 20, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.