Tuesday, October 18, 2022

[FIXED] how to write a dockerfile and build a docker image?

Issue

How to write a dockerfile and build a dockerimage. i would be grateful for a step by step instructions and illustrations if possible. i am new to usage of docker and we are using on linux platform.


Solution

  1. First you have to install and configure docker in your local machine

  2. Make directory for store docker file

    mkdir docker-test cd docker-test

  3. Create docker file in your repository

    nano Dockerfile

  4. Add follow line to Dockerfile

    FROM docker/whalesay:latest RUN apt-get -y update && apt-get install -y fortunes CMD /usr/games/fortune -a | cowsay

  5. Build docker file run follow command

docker build -t docker-whale .

If you want to further details about build process read full article here.

If you have any problem please comment.



Answered By - Niroshan Ranapathi
Answer Checked By - Katrina (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.