docker basics

So right now every one talks about docker. Some of them use it and others just talk about it, but anyway its a hot subject right now. So here is what it is for me right now:

Docker is an an open-source-project that extends and improves your virtualization. You can work with docker on all three main systems like windows, MacOS and Linux. Docker does two nice main parts to me:

    • Change the platform-background-operation
    • Easy to use and control

The platform-background-operation compared to a normal virtualization-process is shown up here:

In docker you do not create a OS for every app you want to virtualize. So that saves you a lot of server-power and server components. Everything you need is a server with a host-OS choosen by you. Than you install docker and there you go. To start you just to install docker and register, because docker works with a docker(-user)-id. After this you can start.

I type my docker statements in powershell. You always have to start by starting docker if it ist not running. If docker is running on your system and you never used it you have to start with the command “docker login”. After this I use the following statement to see what containers are out there. The parameter -a will show me also containers that are not running right now:

docker ps -a

To have a container there are to main-steps: pull & run.
But how ever if you wanna run a std. container that is out there as a image and you do not have it it will check out and pull before running automatic. So to run your first program you can do something like this:

docker run busybox echo "hello world"

After doing this you should see your busybox echo “hello world” container with the docker ps -a command.
If you have lot containers and want to delete all that are status = exited you can do something like this:

docker rm $(docker ps -a -q -f status=exited)

the parameter -q will just display the number and the parameter -f will describe a filter. You also can add –help to every command to see possible parameters for a statement like this:

docker ps -a --help

To have a ubuntu machine you can do something like this:

docker run ubuntu

Now docker will download an ubuntu image and create a container up for you. You can go and and go to the commando line of that linux machine by using:

docker run -ti ubuntu