menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Devops News

>

Day 4: You...
source image

Dev

3w

read

218

img
dot

Image Credit: Dev

Day 4: Your first Container

  • Today, we will go through the process of dockerizing a simple Go application that prints "Hello, World!" to the console.
  • To start, create a new directory and a new file called main.go.
  • After that, create a Dockerfile that will define how to build and run your application.
  • The Dockerfile will contain a set instructions for docker on how to build and run your application.
  • Use the docker build command to create an image of the application.
  • Once the image has been built, it can be run with the docker run command.
  • The container exits immediately because that is what our application does.
  • Make sure to run docker ps --all and not docker ps because docker ps only shows running containers by default.
  • Change some lines in the Dockerfile and see what happens.
  • Tomorrow we will take a deeper look at what exactly happend when we built our image and learn some more ways to interact with containers.

Read Full Article

like

13 Likes

For uninterrupted reading, download the app