Skip to content

WilmsJochen/docker-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Exercise: Build your own docker container and push it to the cloud.

Good you found this git repo!

IMPORTANT: Make sure to always replace YOUR_NAME with a lowercase name and use this name consistently. If there are people with the same name in this group, please use your nicknames to avoid confusion.

MOST IMPORTANT: please ask questions whenever you want.

Choose your language

In this project you can find some basic examples for different programming languages. Have a quick look on all the different dockerfiles and source code in these folders. Needless to say that this list of languages can be expanded.

Environment

You can execute this exercise on all machines, but if you do not have all binaries installed, you could use the playgrounds of following website. https://killercoda.com/playgrounds/scenario/kubernetes

Instructions

Checkout Git repo

To use our code on the virtual machine, we need to clone this git repo.

  1. Clone the git repo
git clone https://github.com/WilmsJochen/docker-demo.git
  1. Change your directory to the repo
cd docker-demo
  1. Have a look in all the folders and files. Verify all the directories and files corresponds to this git repo.
ls

Build your first docker image

In this step we are going to build a docker image and push it to a docker repo. We will start with the server code as we will deploy this to kubernetes in the next exercises. If you have time left at the end of the session you can come back to this exercise and build the job code as well.

  1. Choose the programming language you are the most familiar with.
cd nodeJs/server
  1. Modify the message that the server will return to a funny message.
nano main.py
nano main.go 
nano index.js

NOTE: To exit nano, press crtl+x -> press y (yes) -> press enter to save it in the same file.

  1. Build your docker image and name the image to your own name.
docker build . --tag YOUR_NAME

NOTE: When you work on one of the newer macbooks with silicon processors, you have to set the platform while building the docker image.

docker build --platform linux/amd64 . --tag YOUR_NAME
  1. Check your docker images.
docker images
  1. Tag your image to give it a proper version number
docker tag YOUR_NAME YOUR_NAME:V1.0.0
  1. Check your tagged image.
docker images
  1. Tag your image again with the docker registry as prefix. This is needed to push your locally created docker image to a docker registry. Take a look at dockerhub to create your own free registry.
docker tag YOUR_NAME:V1.0 REGISTRY_NAME/YOUR_NAME:V1.0.0
  1. Push this tagged image to the docker registry.
docker push REGISTRY_NAME/YOUR_NAME:V1.0.0

Congratulations! You've managed to create your first docker image and make it accessible in a docker registry.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published