DEV Community

hayden-angello
hayden-angello

Posted on • Edited on

Playing with Docker

Welcome to Docker

Docker is a crazy container architecture that lets users deploy instances of an application which makes it easy for a dev to customize and clone their machines without messing things up on their system. Essentially with Docker you can just throw everything you need to run into a package and distribute it to any end user to mess around with. I still haven't fully wrapped my head around its limitless capabilities so bare with me while I stumble through playing with Docker. Let's get to it!

Getting Started

First you are going to want to head to the Docker Playground here

Click the green button to get started and it should drop you into something that looks like this
Image description

To get a new instance up and running all you have to do is press the "Add New Instance" on the left panel and you are well on your way
Image description

The next thing you want to do to get a microservice running is to clone a github repository, for this example I will be using a newsAPI service, you can use NASA image search here or anything.

I will start with

git clone https://github.com/heyMP/news-api-workshop && cd news-api-workshop

Image description

Next, we need to configure our settings for this application. These settings will be an API key and the url of the Play With Docker instance.

cp dot.env.example dot.env

In the 'editor' screen you can add API keys from here into the dot.env file

At the top of the screen, make sure Port 4000 is open, then copy the webpage it directs you to, into the dot.env file

Run it

To run this, type

docker-compose up

and we can see our application running on ports 80 (front end) and 4000 (back end)

Image description

Image description

You can use any repo here and as long as you edit the API keys and the endpoints you can have any application up and running as easy as that. Happy coding!

Top comments (0)