/Beginners-Guide-In-Docker

First implementation of docker to create an image

Primary LanguageGoMIT LicenseMIT

ascii-art-web-dockerize

This is a continuation project of the ascii-art project that consists in creating a docker file that will be used run the project from a container.

Getting Started

To get started with the project, download and install Go programming language using the link: https://go.dev/doc/install

Prerequisites

Before interacting with the project, make sure that your local machine has docker installed and the docker engine is running. Use the command below to confirm that the engine is running:

docker version

You will know that the engine is running if you see its details listed as shown below.

Installation

  1. Clone the repository from its remote location to your local environment with the command below:
git clone https://learn.zone01kisumu.ke/git/gonyango/ascii-art-web-dockerize.git
  1. Navigate to the project's path
cd ascii-art-web-dockerize

Usage

Before running the program, the user needs to build an image of the docker file in their local machine. An image file can be built using the command below:

docker build -t [SPECIFY-IMAGE-NAME] .

Once an image file has been built, run the container with the command below:

docker run -p 8080:8080 [IMAGE-NAME]

or

docker run -d -p 8080:8080 [IMAGE-NAME]
  • Example
  1. Build an image out of the docker file using the below command:
docker build -t ascii-art-web-dockerize .

  1. List the images to confirm the image with the specified name has been built using the command below:
docker images

  1. You will know that the build process was succesfull if the specified name appears on the listed images. You can now run a container from the image using the below command:
docker run -p 8080:8080 ascii-art-web-dockerize

or

docker run -d -p 8080:8080 ascii-art-web-dockerize

NOTE: Using the second command to run a container makes the container run on detached mode. This means that the container won't stop running even if the terminal is stopped and may therefore affect perfomance of the host machine if left to run for a long time. Use the command below to view the status of your containers:

docker ps -a
  1. If successfully running, a feedback is displayed to the user informing them that the server is successfully running at port http://localhost:8080 as shown below.

From the illustrated example above, our server is running on port :8080 and can be accessed by accessing the url http://localhost:8080 on the web browser or clicking on the link using CTRL + Left Click combination.

From this point, the user can interact with the program in a variety of ways including:

  • Providing input using the textarea

  • Selecting their preferred banner file

  • Submitting their input for processing

Contributors

Granton

Edwin

Granton

Granton

Acknowledgement

License

This project is licensed under the MIT License. See the LICENSE file for details.