Why is Docker a Powerful Tool?
One of the main reasons Docker is a powerful tool is its architecture. Docker uses a client-server architecture. According to the Docker documentation,
The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers
A visualization of this occurring:
Starting out with Docker
To begin using the Docker Playground follow these steps:
Go to this link
Navigate to the section labelled "Play with Docker"
Log in or create an account
Press the start button and add a new instance
How to Create a Dockerfile for NASA Image Search
Setup
- In the Docker Playground add a "New Instance". This will open a terminal on the screen.
- On GitHub, navigate to the Nasa Image Search repository and click "Code". Copy the link, and in the Docker Playground run a
git clone
andcd
into the cloned repo
Configure
- Run this command:
touch "Dockerfile"
. This will create a new file calledDockerfile
. This is where custom settings can be added. - Access your new file via the "Editor" in Docker Playground.
The document that you have added will need to be configured.
Now we must reference an endpoint for Nasa Image Search. For this example, the endpoint would be
https://402a.github.io/ip-project/
In the News example, this is where you would run cp dot.env.example dot.env
. This would give you the ability to open the dot.env
file and populate it with specific data (a generated API Key and the NewsAPI endpoint):
For the Nasa Image Search example you can first run another touch command. For this, I ran touch "dot.env"
. Here, you would populate the document via the editor. The endpoint, https://402a.github.io/ip-project/
is added to this document.
Open Port
- Once you have completed the configuration, you can now click on the "Open Port" button at the top of the Docker Playground screen.
- You will be prompted to enter a port number. For this example, I inputted "4000"
- You will not immediately be able to open the desired page. To do so, you will need to copy the URL of the page that opens when you input "port 4000".
- This URL should be added to the
dot.env
file as the endpoint. Click 'Save' after this has been added.
Starting the application
- After everything has been added, run the line
docker-compose up
in the playground. This will open port 4000.
- Click on port 80. If all was successful, you will be able to view the working application.
News Example:
Helpful Links:
For the News API Key: News API Site
Top comments (0)