DEV Community

Interaction Designs
Interaction Designs

Posted on

New to Docker? Try it out for free!

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

  1. 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:

play with docker homepage

  1. 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.

  2. 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.

  3. Once it's done cloning, let's navigate to that folder with cd HAXcms.

  4. 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.

  5. 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.

docker running

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.

Top comments (0)