Docker basics in a nutshell

I have a number of posts from my playing around with Docker so far. I’ve seen a number of posts from people asking how they should get started with Docker. There’s a number of getting started guides that will get you up and running. Try the Getting Started tutorials on the Docker site.

I’m not going to attempt to re-write my own version of other tutorials as they are good already. Instead, I’m going to distill down a few core steps as a quick reference and a quick example. If you’ve no idea what Containerization is about, this page is a good overview.

Assuming first if you’re on Mac or Windows you’ve already installed the Docker Toolbox. If not, head over here and follow the instructions.

In a nutshell:

  • images are read-only definitions used to create a container (they describe the content of a container, starting with a base image, at the very least a base Linux OS)
  • You can browse shared images at Docker Hub (or host your own hub)
  • images can be used as the starting point and extended to create other images
  • a container is an instance of an image that can start, pause, stop

Start the Quickstart Terminal.

Let’s pull an image (busybox) and start it up:

  • docker pull busybox

Now let’s run a container based on this image, run it interactively (-i) capturing the tty (-t) and execute a shell (the hex value is the id of the image):

  • docker run -it c51f86c28340 sh

On a reasonably recent machine you’ll probably see the sh prompt appear in a second or less. If you exit the shell, your container will also terminate because it’s not running anything (by exiting the shell you terminated the command you asked the container to run).

You can see currently running containers with ‘docker ps’ and list all containers included recently terminated with ‘docker ps -a’:

Let’s start it up the same container again in interactive mode: ‘docker start -i 9fd9f0402821′ :

Each time we start it up, you should notice it starts pretty quick, in 1 second or less.

Containerization vs Virtualization

If you’ve ever installed a guest OS in a virtual machine using virtualization software like VirtualBox, VMWare or Parallels, you should now be noticing a major difference between containerization and virtualization. How did that container boot so fast??!!

The difference between these two approaches is that virtualization allows sharing of the platform hardware, so multiple guest OSes can be installed on the same hardware. Containers on the other hand allow sharing of the operating system – each container shares common libraries and resources from the underlying Linux OS. Containerization solutions like Docker rely on features natively provided by Linux to achieve this. Running Docker on a non-Linux platform, like Windows or OS X requires hybrid approach running a Linux guest in a Virtual Machine – the Docker Toolbox and docker-machine takes care of this for you.

Next steps from this point would be to create your own image running some service or app in a container. If you look through some of my previous posts, hopefully these will now make more sense now we’ve covered some of the basics.

Go try it out for yourself!

Installing a CosmosEx on an Atari ST (SD card based HD and floppy replacement)

I’ve had my eye on the CosmosEx device for the Atari ST for a while – it provides SD card based harddrive support, floppy emulation using .st image files, and has support for USB based flashdrives, either formatted in ST or DOS format. I decided to finally order one and it arrived this weekend.

wpid-20151129_152503.jpg

The most incredible thing is it’s built around a Raspberry Pi, plus some other additional custom built hardware. Quite an incredible piece of custom designed and built kit.

My first dilemma was whether I should connect it as an external floppy drive (requiring to find a DIN 14 cable which is apparently hard to come by nowdays), or replace my internal floppy drive with the CosmosEx. Given that the CosmosEx connects directly to the internal floppy ribbon cable and power supply, this seems like a much easier option. To mount it permanently in the case you have to cut a notch at the back of the case for the harddrive connector, and widen the existing floppy disk access so you can get to the entire front of the CosmosEx device when inside the case.

I’m not sure I wanted to go that far, so it’s currently mounted loosely inside with the top cover off, and I have ordered an IDE floppy extension cable so I can extend the cable outside the case and have the CosmosEx sit on top of the case.

I’ve learnt a bunch of random things getting this setup this weekend:

  • TOS 1.0 ROMs can only access 256MB hard disk partitions. The HD support is also pretty buggy and terrible (generally known fact), so upgrading to 1.04 may be a future project.
  • The SC1224 Atari color monitor does in fact support both 50Hz (European) and 60Hz (US) games if you adjust the vertical sync just right with a screwdriver in the vsync hole on the back of the monitor. From playing with menu disks burnt to real floppies in the past, I’d come to the conclusion that I couldn’t play any menu disks that were deliberately changing to 50hz (like most European games do) because the  monitor would start rolling. If you adjust the vsync though just enough to stop the rolling, when toggling back and forth from 50 to 60Hz the monitor does actually adjust between the two modes automatically. I hadn’t worked this out before, but some Googling about the SC1224 monitor did say that it supported both modes, and yes, it does (I have the Goldstar model)

So far I have an SD card partitioned with a few 256MB partitions and I’m using the ICD driver. This is apparently not the best available driver but is currently free, so trying this one out for a while.

So far, very happy! The option to download .st images on the fly from an internet connection is also very cool!

Watch animation of code executing on an ARM1 in your browser

I’ve spent some time this year learning ARM assembly, so this post on The Register got my attention. To celebrate 25 years of ARM architecture, a group has developed a browser based animation of the ARM1 cpu executing – you can zoom in/out and pan around the visualization with your mouse. Even if’ve no specific interest in ARM take a look anyway, this is quite an incredible, interactive browser based 3d model.