Changes

Jump to navigation Jump to search
application/Dockerfile
ENTRYPOINT [ "/application/run.sh" ]
</syntaxhighlight>
 
That's basically already what is different from a container deployment to executing the application directly on your system. Of course, there are more details to learn, in particular about how to mount external filesystems of the cluster into the container, so you can read/write persistent data. More on this later. Let's now run the container defined in the above configuration files.
 
 
=== Building and running the container ===
 
In the example_1 directory, do a
 
<syntaxhighlight lang="bash">
> docker-compose up
</syntaxhighlight>
 
You should see the base container image being downloaded (if not already on your system), and then the changes specified in the Dockerfile being made. Afterwards, the container is run, which should create similar output as if running it directly on your system.
 
While we are at it, we can try some other things. For example, let's start the container in the background instead:
 
 
=== Inspecting a running container ===
 
Let's start the container in the background using the -d flag. Note that you will not see console output anymore.
 
<syntaxhighlight lang="bash">
> docker-compose up -d
</syntaxhighlight>
 
The container is now listed under running containers.
 
<syntaxhighlight lang="bash">
> docker ps
</syntaxhighlight>
 
We can check the console output by reading the logs, using the ID of the container.
 
<syntaxhighlight lang="bash">
> docker logs ...
</syntaxhighlight>
 
We can also open a shell inside the container, and inspect it's contents. In fact, you can also execute any other command in it.
 
<syntaxhighlight lang="bash">
> docker exec -it ... /bin/bash
</syntaxhighlight>
 
We can also copy the output of the container into the filesystem of the host using an scp-like syntax:
 
<syntaxhighlight lang="bash">
> docker copy :... ./tmp/output
</syntaxhighlight>
 
This should give you an idea of how powerful this framework is.
== Logging console output of our program ==

Navigation menu