Benjamin Guttmann
Published at 17.01.2016
Welcome to the first part of our series about Concourse CI and Docker.
The main purpose of this series is to explain you what Concourse CI is and how to use it. During the different posts we will build two example pipelines, one to manage your Docker images and another for building and testing a sample application. Since Concourse CI is using containers, we will take the chance to give you a brief introduction of using Docker.
This part provides you the general information of Concourse CI and a small „Getting started“ for Docker.
Table of Contents
As the CI in the name Concourse CI implies we talk about a system for continuous integration. We could do continuous deployment (CD) with Concourse as well – we will do so later on. The question is, what differs Concourse CI from the other products you know?
Concourse CI is designed to be simple, you should not spend lots of time to get to know your CI system, you should devote your time to developing applications. The idea of Concourse is that the best tools can be learned in one sitting. To ensure this, Concourse defines just three basic elements that can express arbitrary features and pipelines. To get to know more about them at this point, check out the Concepts.
We will develop this topic in a subsequent post.
Concourse is optimized for quick navigation through your pipelines and logs of your jobs.
Now, as Concourse is statically configured, you can recreate it from scratch with a single bosh deploy, that also means that if your deployment’s infrastructure burns down, just deploy somewhere else. In addition to this, scaling up is as easy as ABC, just adjust the number of workers in your BOSH deployment manifest, scaling down is similar to that.
One of the coolest features of Concourse CI is perhaps the possibility to create pipelines. These pipelines consist of resources and jobs. You can chain different resources and jobs together, so you can configure your pipeline in that way, that if a resource, used by a job, is changing, the job is executed automatically.
To keep the core of Concourse small and simple, special features are provided to the user, as resources,
just to name a few of them.
Now, you will get to know about :
So, let’s start with installing Docker on your machine.
These guides are based on the official Docker Guide ( please check it out for new versions ).
If you see this, you can start working with Docker ;-)
There is also a „brew-way“ of installing Docker Toolbox, just use Step 2b instead of Step 2a.
To get to know your current version of Mac OS X you should
for the current version you need Mac OS X 10.8 „Mountain Lion“. So, if everything is okay, let’s move on.
To install GUI Mac applications you need Homebrew-Cas,and don’t worry, its installation is straightforward. Just add the cask tap and install brew-cask.
Notice: !!! Please make sure that there is no VM up and running in VirtualBox while you try to install Docker Toolbox, this can cause the installation to abort. !!!
If you wish to use the GUI to verify your installation use 1a, 1b shows you how to verify your installation simply using the terminal.
If everything runs well you should see an output like this:
[code light=”false” language=”bash”]
$ docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
535020c3e8ad: Pull complete
af340544ed62: Pull complete
Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/
[/code]
Jump to the next step, Docker Hub.
This guide uses a terminal for the installation, so please open a terminal to insert the given commands.
To check if you got wget installed
[code language=”bash”]$ which wget[/code]
if you get a path as an answer, everything’s alright and you can switch to Step 2, if you get nothing as an answer please do the following steps.
For Ubuntu/Debian users:
[code language=”bash”]
$ sudo apt-get update
$ sudo apt-get install wget
[/code]
For centOS users:
[code language=”bash”]
$ sudo yum update
$ sudo yum install wget
[/code]
To get the latest Docker package use:
[code language=”bash”]
$ wget -qO- https://get.docker.com/ | sh
[/code]
The system may prompt you for your sudo password, and afterwards it will download and install Docker together with its dependencies.
Sometimes it happens that the apt-key command fails during the installation, then you can add the key directly using the following:
[code language=”bash”]
$ wget -qO- https://get.docker.com/gpg | sudo apt-key add –
[/code]
Now you can try the first wget command again.
Insert
„docker run hello-world“ to the command line, to verify if docker is installed correctly.
Yes, it is as easy as that. ;-)
If everything runs well you should see an output like this:
[code light=”false” language=”bash”]
$ docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
535020c3e8ad: Pull complete
af340544ed62: Pull complete
Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/
[/code]
Jump to the next step, Docker Hub.
This guide uses a terminal for the installation, so please open a terminal to insert the given commands.
Your machine must be running Windows 7.1, 8/8.1 or otherwise it will not run Docker Toolbox.
If you used the default settings of the installation, you should find the Docker Toolbox Icon on your Desktop.
If everything runs well you should see an output like this:
[code light=”false” language=”bash”]
$ docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
535020c3e8ad: Pull complete
af340544ed62: Pull complete
Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/
[/code]
A perfect place to search for existing images built by other people is Docker Hub.
There, you can search easily for any image you can think of. These images can be used as they are, or you can base your new image on them, but more on this topic will come out in the next part of this series.
As the first thing we will search for docker’s way of hello world, so enter „whalesay“ in the search bar and hit ENTER.
You will get lots of results for this search term but we are looking for the one and only: docker/wahlesay.
Click on the „Details“-Button and here you get lots of information:
Now we can copy the Docker Pull Command (docker pull docker/whalesay) to a clipboard, we will need this in the following step, but first let’s have a look at the pull command:
[code language=”bash”]
docker pull docker/whalesay
[/code]
As you can see, the first word (docker) indicates that this is a docker command, the „pull“ is the action to perform and after this the image is specified the first part names the owner, in our case this is „docker“, and the last part is the name of the image named „whalesay“, the parts are separated by a / .
If your Docker QuickStart Terminal isn’t already running please start it now.
Paste the pull-command from your clipboard into the console or insert it by hand, after that hit ENTER.
At this moment, the terminal is pulling the image with its different layers, after it’s finished you can enter the following command to run your first container:
[code language=”bash”]
docker run docker/whalesay cowsay boo
[/code]
At this moment you should see an output like < boo > and a whale consisting of ASCII symbols.
That’s all. Easy, isn’t it ?
Well, just one small remark, you can enter the docker run command right at the beginning without the pull command – if docker can’t find an image it will download it automatically from Docker Hub for you.
I think that it is more than enough as for the first part. Next time, I will show you how to build your own Docker images and upload them to Docker Hub.
Read part two of Getting started with Concourse CI and Docker >>
© anynines GmbH 2024
Products & Services
© anynines GmbH 2024