DEV Community

Run your first container

Prequisties:
1.Make sure you installed Docker Desktop and link to download software - https://docs.docker.com/desktop/
2.Create a login using https://hub.docker.com/
3.Open the docker desktop and login using the login you have created earlier

Step by step approach for containerisation using the sample repo

1.Clone the repository - Clone the repository at https://github.com/sparanduru/welcome-to-docker.git

git clone https://github.com/sparanduru/welcome-to-docker

Enter fullscreen mode Exit fullscreen mode

2.Now we need to run the docker commands in the solution folder and point to the correct structure

cd welcome-to-docker
Enter fullscreen mode Exit fullscreen mode

3.Verify your Docker file - Open the sample application in your IDE. Note that it already has a Dockerfile. For your own projects you need to create this yourself.

4.Build your first image - You can build an image using the following docker build command via a CLI in your project folder.

docker build -t welcome-to-docker .
Enter fullscreen mode Exit fullscreen mode

The -t flag tags your image with a name. (welcome-to-docker in this case). And the . lets Docker know where it can find the Dockerfile.

5.Run your container - Once the build is complete, an image will appear in the Images tab. Select the image name to see its details. Select Run to run it as a container. In the Optional settings remember to specify a port number (something like 8089).

6.Open the docker desktop and select the image which we have created and click on it

7.Your First application is up and running

Conclusion: How to your first container

💬 If you enjoyed reading this blog post and found it informative, please take a moment to share your thoughts by leaving a review and liking it 😀 and follow me in dev.to , linkedin

Top comments (0)