Skip to content

verlandz/learn-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker

Introduction

Purpose

Make a simple project with docker and help to learn the basics.

Objective

This project will make 2 containers: 1 app & 1 datastore(redis). The app will get data from redis and show it in the response. For redis image, we can download it from the official docker registry, but for app image, we will make it by ourself. The language to make the app is Golang aka Go.

You can use another language than Go, but this project will focus on using Go.

Author Setup

  • OS: Ubuntu 16.04.6 LTS
  • Docker: Docker version 18.09.7, build 2d0083d (Docker Engine - Community)
  • Docker-Compose: docker-compose version 1.24.1, build 4667896b
  • Docker-Machine: docker-machine version 0.16.0, build 702c267f
  • Golang: go version go1.13 linux/amd64

Docker Images

It's a common pratice to not use latest tag

Prerequisite

Usually docker need to be super user, so try to sudo su - first.

FAQ
Q: Why we need to install go to our device if we can pull go image to our docker ?
A: The reason is for comparison version. So in docker, we're using go1.11 but in local we're using another version. Also having install go in your device make a guarantee that you understand how to manage GOPATH and GOROOT, we need it to undestand for dockerfile.

Walkthrough

You can follow from this docs
If you don't see root@verlandz in sample cmd, that's mean it's not running on the root