Home  >  Blog  >   Docker  > 

Management of Complex Docker Containers - Docker

Rating: 4

Docker containers are highly used in production environments. Due to the nature of this environment, the containers used in this case are very complex. One needs to know how to manage these. This will be explored in this chapter.

The Docker Machine Beta

This tool was recently introduced, and it can help you to move from nothing to a very complex Docker container. It can be used for the creation of Docker containers on your machine, in cloud environments, in data centers, and then it is used for the configuration of the Docker client so as to communicate to these. It is used as follows:


On execution of the above command, everything will be set up. This will download the Machine and then install it on your computer. Notice the use of the “ -d” flag, which will run the process in the background. The command will run in a verbose manner, and you will observe the following output as it runs:

This shows that it tells or informs you of how it is progressing. Once the above command completes its execution, just run the following command:


There will be no observed output from the above command. Next, just run the following command so as to test whether or not the installation ran successfully:

Learn how to use Docker, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll in Free Docker Online Training Demo!


What the above command does is that it checks for the presence of the “busybox” image in your local system. If it is not available, it will download it from the Docker Hub. The image will then be executed, and you will observe some text on the output. The command will run in a verbose manner, and in my case, I get the following output:


As shown in the above figure, the command has finally printed the “hello world” message. The image was not found locally, so this is why it has been pulled from the Docker Hub.

MindMajix Youtube Channel

How to run a Dockerized App

Installation of Docker is very easy. Once you have installed it, you need to run the dockerized application. With Docker, a Registry that contains public applications is maintained which are made available as public images. In this section, we will explore how to use the “JSDetox” JavaScript deobfuscation tool in your Docker.
There are a number of packages that need to be installed alongside this package. The problem is that most of these packages might end up conflicting with the ones you have already installed. However, due to the distribution property provided by Docker, this problem is solved.
The image for this can be run by executing the following command:


Once the above command has been executed, open your browser, and then enter the following URL:


In my system, I get the following output from the previous command:


In case you are using either Mac OS X or the Windows operating system, the steps can be a bit tricky. However, with the assistance of the boot2docker tool, this will become easy. You just have to connect the IP address of the virtual machine being set up by Docker. As shown in the above figure, the image which we have specified, that is
“remnux/jsdetox,” was not found in the local system, so it was downloaded from the Docker Registry. After running the JSDetox, it will begin to listen from port number 3000. However, we will be unable to access the port from our container, due to the fact that it is running from a container. We have to redirect to the port so that we get the
following output:


The above will be the output on the browser once we execute the URL which we previously gave.

Related Article: Docker Interview Questions and Answers

Building process

Suppose that we want to build the Docker image for the application. To do this, we can start with the core image of the core OS, and then run it in Docker. Necessary tools can then be installed, and then perform the necessary configurations. Consider the command given below:


What the command does is that it will instruct the Docker to use the Ubuntu’s 14.04 public license as the base image of the image we are going to create. Consider the next instructions given below:


What the commands do is that they will instruct for the OS to be upgraded and for some packages to be installed. These are the packages that the JSDetox needs so as to be able to run. Note that the command “apt-get” should be run while having the administrative privileges. Consider the next command given below:


What the above command does is that it adds a group and a user named “nonroot” to our image. This means that we will be able to run or launch the JSDetox without having the administrative privileges. Consider the next commands given below:


The commands shown above are responsible for the downloading of the JSDetox from the GitHub repository. This will be done as a “nonroot” user.
The next commands are given below:

bundle install

What they do is that they will install the JSDetox into the system.
Now that we have accomplished the task of downloading and installation, we need to establish a way how it will be launched or started. Consider the commands given below:


When the above commands are executed, you will have specified how the JSDetox application will be started by the Docker once the container is launched. You will then be done.

List Of MindMajix Docker Courses:

 Kubernetes Administration
 Docker Kubernetes
 OpenShift Administration


Join our newsletter

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
Docker TrainingDec 10 to Dec 25
Docker TrainingDec 13 to Dec 28
Docker TrainingDec 17 to Jan 01
Docker TrainingDec 20 to Jan 04
Last updated: 06 December 2022
About Author
Vinod M

Vinod M is a Big data expert writer at Mindmajix and contributes in-depth articles on various Big Data Technologies. He also has experience in writing for Docker, Hadoop, Microservices, Commvault, and few BI tools. You can be in touch with him via LinkedIn and Twitter.