DEV Community

smm7530
smm7530

Posted on

Docker

Why docker is a powerful tool

Docker can help developers build and run containers simply and easily and automated save all the work through a single API. It can separate an application into several pieces to build different functions and run the application as a whole. It can also update futures faster and cheaper.

Get Start

Everything starts with making an account and login to the PWD terminal and start docker by running docker run -dp 80:80 docker/getting-started:pwd.

Image description

NASA Image Search

In the termina, type code git clone https://github.com/heyMP/news-api-workshop && cd news-api-workshop to clone a repo and in the repo, type code cp dot.env.example dot.env to create a new file called dot.env. Then click editor to edit filesystem.

Editor --> news-api-workshop --> dot.env

Image description

Go to the link to get a new API key and replace NEWS_SERVICE_API_KEY=XXXXXXXXXXXXXXXXXX and click open port in Docker. Type 4000 when they ask the port number as it appears in the editor NEWS_ENDPOINT=http://news.traefik.me:4000.

Image description

When it pops up a new web page, copy the link to replace the NEWS_ENDPOINT and save it.

Finally run docker-compose up. It can open port 4000 and you should be able to click port 80.

Image description

Result:

Image description

Top comments (0)