What is Docker?
Docker is a very powerful tool that allows users to containerize applications. As for what that means, Docker defines Containers as
A standard unit of software that packages code and all dependencies so the application runs quickly and reliably from one computing environment to the other.
Essentially, it allows a developer to quickly package and deploy applications across environments.
Getting started.
Docker is a powerful tool yet has its own learning curve as with all programs.
to get started I'll be walking through using Docker with a news gathering API.
First, go to Play with Docker
Create a new instance in the Docker Lab
in the Docker terminal
git clone https://github.com/heyMP/news-api-workshop && cd news-api-workshop
this will get you the repo needed to do this activity.next you will need to cd into the repo. to do this run
cd news-api-workshop
then run
cp dot.env.example dot.env
Above the Docker terminal there is a button that says edit, click that and navigate to the dot.env file you just created. as you'll see, you need an API key. to get this go to newsapi.org and sign up for free. When it gives you this key, copy it into the dot.env file where it says API key and press save
Now, go back to the Docker lab and press the port button and enter 4000. this should bring up a blank web page with some error message, thats OK! just copy the url from that page and paste it in the dot.env file where it says NEWS_ENDPOINT
Now, in the Docker terminal
run docker-compose up
after the command finishes it should look like this:
- Now click on the port 80 button that appeared at the top of the lab, this will bring you to the functioning API and look like this:
Top comments (0)