Head in the Cloud

My journey to work in cloud technology

My Docker Installation

December 10, 2018 · AWS, Docker

I've been a systems admin for more than a decade, but I completely missed the advent of containerization. My old organization could not afford the infrastructure to a virtual environment, so I bought cheap servers and cluttered the data center with them, trying to avoid a single point of failure, patching and loving each of my little snowflakes on a constant and time consuming basis. When I learned about AWS, cloud virtualization was the perfect solution to our budget constraints, as servers were no longer a fixed cost and an inventory asset. However, learning about Docker has taught me to rethink how I deploy services.

My goal here is to use docker as a platform for specific services, rather than install software and configure individual software packages. In addition, the images and dockerfiles can be pushed to repositories and pulled to other docker installations, so the work I do here can be re-purposed to my work scenario.

My journey begins with the install on my local Windows system. I chose to use the Docker for Windows (also called Docker Desktop) application, which let's me run docker commands from the Windows command line. I also have the ubuntu subsystem on my Windows machine, since I do most of my work at the linux command line, just I chose to not use the ubuntu subsystem (although I do appreciate how Microsoft is supporting linux without having to run a virtualized environment). I'm not sure this was the best decision, but I'd rather not rebuild my entire machine right now :-)

The biggest issue I have with this set up is the fact that I have yet to successfully allow Docker to connect to my local shared drives without shutting down my Norton's smart firewall. Either I or the firewall are not all that smart, since I've followed the docs and added a rule for Docker, but I always have to turn off my firewall when I start a container that has a shared drive, such as my jenkins instance. It's rather annoying.

I also have a Docker Desktop set up on my Mac, which doesn't have the same firewall problems, but I rarely use it.

I set up a github account and a docker.com account so I can publish my dockerfiles and push my images, and also set up installed git, but this time as part of the ubuntu subsystem. I don't want to spend time navigating a GUI for git, since I really only use about seven git commands on a regular basis. 

  • git clone
  • git pull
  • git add *
  • git status
  • git commit -m "message goes here"
  • git push
  • git  reset --hard HEAD

 I've yet to figure out how to make branches work for me, since I am a dev team of one. Problem for another day.

So, I have docker at the command line, a directory for my scripts, and a repo for my images. Ready to rumble!

Here are some docker basics:

  • docker ps -a    -    gives a list of available containers and their status
  • docker rm <name>    -    deletes a docker container. The <name> can be its label or its container id. The automatically generated names can be a bit hilarious.
  • docker images    -    gives a list of pulled images.
  • docker rmi <name>   -    deletes a docker image.
  • docker system prune    -    deletes all containers that are not running.
  • docker run -it <repo/image>    -    start an image.
  • docker run -it --name <myName> -p <local port>:<container port>/<protocol> <repo/image> <shell or command>

Next:  My Jenkins Installation