With all this virtualization talk it's nice to setup our own Docker machine as it does indeed has some good features.

Documentation on how to install (in 3 steps) can be found on the main website: Installing docker on debian

First of all we need a "Dockerfile" that contains the information on how to build our new machine.

So let's create a folder and throw all the required files(it's configuration only, we will install the dependencies automatically).

In that folder we create the Dockerfile itself:

FROM debian:stable 
#Here we select the OS/base we are using for this
RUN apt-get update 
#As we will be installing packages we better have all our sources updated
RUN apt-get install -y ca-certificates 
#Now we install the required dependencies 
#Here we are setting the working directory
COPY . /app 
#Now we copy all the contents of the current folder into the app folder
CMD ["./application"] 
#As soon as everything is ready, we launch the app

Now we just need to create the image itself by doing the following:

docker build .

We will see the following:

Sending build context to Docker daemon  8.056MB
Step 1/4 : FROM debian:stable
 ---> 40e13c3c9aab
Step 2/4 : WORKDIR /app
 ---> Running in e9cd82f24260
Removing intermediate container e9cd82f24260
 ---> ed0333da0cf4
Step 3/4 : COPY . /app
 ---> 400e5bfc4da1
Step 4/4 : CMD ["./application"]
 ---> Running in a9720610c6c0
Removing intermediate container a9720610c6c0
 ---> df44cfa163bb
Successfully built df44cfa163bb

Having the image successfully created we can see it in the list of current images(the id of it will be df44cfa163bb, as seen in the last message):

docker image ls

If we don't like it we can remove it(in this case, forcefully):

docker image rm -f [ID]

If we are ready, we can run it:

docker run -it [ID]

In the case the process runs in the foreground and we want to send it on its way to the background, we can detach by pressing CTRL+P, CTRL+Q.

Then we can see if it's still running:

docker ps

If we want to jump in to our docker image to see if everything is working correctly (logs are being written, data being sent, etc) we can do the following:

docker exec -it [ID] /bin/sh

To rename a docker image we can do the following:

docker tag [ID] mycooldocker

To get the ip of the docker container without entering it we can use the following command:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' [ID]