-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f19c61a
commit c07fcd7
Showing
1 changed file
with
7 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
# Practice - building images | ||
|
||
Your project utilizes microservices and Kuberenetes. On your cluster you have many containers (pods) with your services. There's a special container which runs Ubuntu and can access the other services' databases and other components. To access those components you install a few CLI tools on this special container. The problem - each time the cluster is re-deployed you must install the CLI tools again because they're not part of the container's base Ubuntu image. | ||
Your project utilizes microservices and Kuberenetes. On your cluster you have many containers (pods) with your services. There’s a special container **jumpbox** which runs Ubuntu and can access the other services' databases and other components. To access those components you install a few CLI tools on this special container. The problem - each time the cluster is re-deployed you must install the CLI tools again because they're not part of the container's base Ubuntu image. | ||
|
||
You want to automate this process by building a Dockerfile for this container using ubuntu:18.04 as your base image. | ||
You want to automate this process by building a Dockerfile for this container using **ubuntu:18.04** as your base image. | ||
|
||
To install those tools you normally use the following commands: | ||
|
||
- $ `DEBIAN_FRONTEND=noninteractive` # Env var required for postgres | ||
- $ `DEBIAN_FRONTEND=noninteractive` # Env var required for postgres installation | ||
- $ `apt-get update && apt-get install -y postgresql` # Install postgres to access dbs | ||
- $ `apt-get install -y wget` # Install wget for downloading software packages | ||
- $ `apt-get install -y curl` # Install curl for running HTTP requests | ||
|
||
:whale: HINT: Research how to set environment variables inside Dockerfiles for the DEBIAN_FRONTEND variable. | ||
|
||
To build the image, navigate to your Dockerfile path and use | ||
- `docker build –t "<name>:<tag>" .` | ||
|
||
Run a container from this image in interactive mode and verify the installations: | ||
1. Create the above Dockerfile and build an image **jumpbox** with a **1.0** tag. Run a container with interactive bash and verify the installations: | ||
- `psql --version` # You should see the psql version | ||
- `wget --version` # You should see the wget version and other info | ||
- `curl 'http://example.com'` # You should see some html | ||
2. Change **curl** to **inetutils-ping**. Build a jumpbox version **2.0** and test again: | ||
- `psql --version` | ||
- `ping 8.8.8.8` |