Here are some sample answers to the questions presented in this chapter:
- The Dockerfile could look like this:
FROM ubuntu:19.04
RUN apt-get update && \
apt-get install -y iputils-ping
CMD ping 127.0.0.1
Note that in Ubuntu, the ping tool is part of the iputils-ping package. Build the image called pinger—for example— with docker image build -t my-pinger.
2. The Dockerfile could look like this:
FROM alpine:latest
RUN apk update && \
apk add curl
Build the image with docker image build -t my-alpine:1.0.
3. The Dockerfile for a Go application could look like this:
FROM golang:alpine
WORKDIR /app
ADD . /app
RUN cd /app && go build -o goapp
ENTRYPOINT ./goapp
You can find the full solution in the ~/fod/ch04/answer03 folder.
4. A Docker image...