Setting up a Docker Host OS

Introduction

This article explains step by step how to a get a bare-metal headless machine ready to serve docker containers. It’ll be able to automate builds and deploy angular apps

 

Install Linux on the PC

We’ll be using Alpine (standard). The reason for that is it’s small size and quick boot time.

  1. Create a bootable USB with the alpine image.
  2. Boot the pc and run through the setup-alpine.

 

 

Install minimal software.

After booting the pc and login in the following commands can be run:

SSH

  1. addgroup users
  2. adduser -s /bin/ash -G users walterwhite
  3. apk add sudo
  4. apk add nano
  5. nano /etc/group
    1. // Add walterwhite (or whatever name you chose) 
      // to the wheel group.  
      wheel:x:10:root,walterwhite
      
  6. visudo
    1. %wheel ALL=(ALL) ALL // uncomment the #

Docker

  1. nano /etc/apk/repositories
    1. uncomment vx.x/community
  2. apk update
  3. apk add docker
  4. rc-update add docker boot
  5. service docker start

Compose

  1. apk add py-pip
  2. pip install docker-compose

Portainer (optional)

Not necessary, but I nice easy GUI served through a web service showing containers running etc..

  1. dfg

Others

GIT

We’ll need this to pull our app.

  1. apk add git

Tip: to never allows have to type the credentials you can run this command in your git project directory:

  1. git config credential.helper store

Nano

Easier to edit files with imo via the console.

  1. apk add nano

Example: Install the Angular App HomeBaseWeb

As a test we’re going to pull a git repo, which features a ready made dockercompose file, telling us where to the dockerfiles are for which containers to spin up.

To do this we’ll create a new project directory and clone the git there:

  1. mkdir mycoolapp
  2. cd mycoolapp
  3. git init
  4. git config credential.helper store
  5. git pull <link t.b.d>
  6. docker-compose up

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s