Lab #14: Create an image with SHELL instruction
|Platform||Number of Instance||Reading Time|
|Play with Docker||1||5 min|
- Create an account with DockerHub
- Open PWD Platform on your browser
- Click on Add New Instance on the left side of the screen to bring up Alpine OS instance on the right side
1- Install Docker latest version.
2- Create a directory for the Dockerfile.
3- Go to the path.
4- Create the Dockerfile with instruction.
vi Dockerfile FROM alpine:3.4 RUN apk update && \ apk add curl && \ apk add vim && \ apk add git
5- Build the Docker Image for Dockerfile from Shell with
#docker build -t image_name .
if you want to remove intermediate containers then use;
#docker build --force-rm -t image_name .
if you want to build without existing cache then;
#docker build --no-cache -t image_name .
here in above commands ‘.’ represents the current directory where Dockerfile kept. If you want to build the Image from remote or different directory then paste the path of dockerfile
If the name of the Dockerfile is different than ‘Dockerfile’ then need to give file name in command line as
Next » Lab #16: Entrypoint Vs RUN