It is possible to install a web server application in Docker?

Hi.

I am new to the blog and new using Docker. I have a question that may sound very elementary or illogical but as I tell you, I am a rookie with Docker and I am still not sure how it works and when to use it.

I need to install an application that is normally installed on a server and then clients connect to the server to use it. It is a web application. Now I need to install it on my laptop where I can perform tests with the application without needing to be connected to the server.

My question is can I use Docker to be able to do this installation and use the application from my laptop?

And if possible, is there any guide on how I can use docker to install an application in this way?

Beforehand thank you very much…

Hello,

it’s possible, of course. :slight_smile:

There generally two approaches.

You can create a Docker container containing your application a then use it as “a service” on your laptop. In this scenario you connect to the application using the web browser installed on the laptop.

You can also use a Docker container as “a virtual machine”. In that scenario the container contains also a web browser, development and testing tools and so on. You can develop your application completely isolated inside the container. This approach is often the easier way for beginners.

You can also use a combination of both approaches, of course.

You haven’t say which operating system you use, but in any case you have to install a Desktop version of Docker on your laptop - check it out here. For using headless containers you will also need some VNC viewer, for example TigerVNC.

You also haven’t mention which kind of web server and web application you use, but if it’s Node.js, then you can checkout one of my Docker images. You can use images without web browser as “a service” and the other ones as “a virtual machine”. You can also build you own containers based on them.

For example, if you would use a container created from the image accetto/xubuntu-vnc-node:latest, you would mount the folder containing your application source code to the container and then start the Node.js server inside the container. You would connect to the application using the web browser on your laptop.

If you would use, for example, a container created from the image accetto/xubuntu-vnc-node:firefox or accetto/xubuntu-vnc-node:chromium, you could develop you application inside the container and use the web browser from inside the container. Note that also in this case you can mount the folder with your source code to the container and you can also connect to the the application using your laptop’s web browser as well.

You can check my image hierarchies here and here.

Hopefully it helps you to start using Docker.

Regards,
accetto

Hi Accetto,

Thank you very much for your response.

Regarding the operating system, my laptop has Windows 10 Pro Build 1909 installed.

The application I need to test needs to run on a Windows Server or on a Linux server. I have an installer for that application. If I am not misunderstanding, this application is the one that should be in the Docker container. My question at this point is: Is there a step-by-step explanation of how to create that container in those operating systems? (Forgive me if I sound too rookie but the truth is that I am on this issue of Docker containers, but I want to learn.)

The idea is to be able to access the application already installed from a web server and perform the functional tests. Normally the tests will be performed from my laptop without connection to any network or internet.

Thanks again for your help.

No problem, everybody has to learn. Actually, we never stop. :slight_smile:

Your Windows version is correct, because you’ll need to enable Hyper-V to be able to use Docker Desktop for Windows. Have you already installed it?

If yes, then the easiest way would be to use Linux containers. You’ll avoid at least licensing issues.

You can start with creating your own containers, but there is no need. You can do that later after learning a little bit.

You can start with ready-to-use containers. There is plenty of them. You didn’t say which application you want to use, so I cannot give you more specific advise about the Linux kind. I think that Ubuntu-based and Alpine-based containers are most popular.

Alpine-based images are very small, so if your application would run on Alpine, you could keep your containers really tiny. However, the “as a virtual machine” scenario would probably not be possible.

Ubuntu/Xubuntu-based images are larger, but more versatile. You work with both scenarios - “as a service” and “as a virtual machine”.

I’ve understood, that you would install your application from Internet. So one possible way would be to use, for example, a container created from my image accetto/xubuntu-vnc-node:firefox or accetto/xubuntu-vnc-node:chromium. These images include sudo and web browsers, so you can install additional applications inside the container easily. It’s (almost) like a standard Linux computer.

There are many step-by-step tutorials on Internet, but it could be a little bit overhelming in the beginning. You can also find useful information in README files of my images or of many other images on Docker Hub.

You can also learn by re-building and/or modifying existing containers. You can use any of my Docker images, because the up-to-date Dockerfile is always included.

You can start with really trivial images like, for example, accetto/hello-there or similar.

Your question is unfortunatelly still a little bit too general. It would be easier to answer more concrete questions. But you have to start somewhere and then you can ask along the way.

So decide about your first scenarion and just try it. After some time it will be easy.

Thank you for all the info.

In effect I have already installed Docker Windows Desktop.

The program I need to install is AppWorks. This allows it to be installed on Windows or Linux.

I will try the options that you indicate to me and along the way I will be asking some questions to learn more.

Thank you,

I see. Do you mean this one or this one?

The first one would be relatively simple. You could use a container created from, for example, accetto/xubuntu-vnc-typescript or similar and just install appworks-js in the container using

npm install appworks-js --save

The second one, however, would be much more complex. You would use at least two containers - one for Java and Tomcat (and AppWorks) and one for the database (probably MySQL or PostgreSQL on Linux). These two containers would provide two services that would form your “application”. You would use docker-compose for that. After installing it you would create a compose file describing you “application” as a set of services. For example, a file called my-aws.yml would define the following two services:

version: '3'
services:
    tomcat:
        image: <some-image-with-java-and-tomcat>
        volumes:
            - <some-volume>
        etc. etc.
    db:
        image:<some-image-with-sql>
        volumes:
            - <some-volume>
        etc. etc.

You would probably need to create some configuration files for both services, therefore it would be the best to mount some folders on your notebook to the images (as volumes). Check Manage data in Docker to learn about that.

You would install AppWorks into the tomcat container, which would use the db container to store the data.

However, that all would be no trivial project and definitely not easy for a beginner.

On the other hand, no pain no gain. :slight_smile:

Hi Accetto,

Sorry for the late response but I had some health problems because I am diabetic and my glucose levels were slightly out of control.

Unfortunately for my little knowledge of Docker I want to install the second option. But as you say, no pain no gain. I know it will be a lot of work for a beginner, but I think it will also be a good learning time.

I appreciate all the help you have given me and I hope it won’t be a bother if I keep asking you about how to use and configure Docker to achieve my project.

You’re welcome.

It’s still not clear to me, what’s your goal, but I hope that you don’t want to replicate the complete OpenText AppWorks Platform. Something like that would not be possible. It’s huge and you would get also licensing problems, because it’s not free, I believe.

You can definitely learn a lot along the way, but the result would be probably frustrating. Maybe you can choose some other similar product from the huge open-source pool.

In any case, have fun and do not give up too soon :slight_smile:

Hi Accetto,

I received an AppWorks course and as part of the course I have access to a trial license with its license code. The goal of all this is to test the operation of the application using a Docker container. It is assumed that the test application can run in a container.

I have the AppWorks installation instructions, but I don’t know how to create the container. Indeed, a container is needed for TomcatEE and the db.I know it is going to be a complex project but I really want to learn how to configure everything from scratch. I promise not to get frustrated, because I am determined to make everything work well so I can put into practice what I learned in the AppWorks course.

I apologize in advance for the many questions I will surely ask.Thank you so much for all your help.