Load my existing Project into Docker Desktop

Can someone please point me to a tutorial that actually shows me what to do with an existing project? I’ve never used docker and I have been tasked with working on a “Dockerized” web-app and I have been told that i just need to run docker on my windows machine and then I will be able to develop the app…or at least run it and test it. However I can’t even get Docker Desktop to see the project let alone run it.

I have changed the “Disk image location” in settings but i still cant search for the image or project or anything. I have this wonderful window open on my computer that does absolutely nothing.

I have even tried to use the beta “Dev Environments” but the project fails to load.

I’ve never come across a more unintuitive piece of software in my life. And every single tutorial or procedure I have found looks nothing like what I have sitting in front of me. I would love to find something that made any sense in all of the documentation I’ve read for the last 4 days.

Considering you have never used Docker and now you want to use Docker Desktop without knowing the basics it is not surpriing that it is hard to start. Docker Desktop has some special features to help developers, but many tutorials will show you Docker CE which is just part of Docker Desktop. I am not completely sure what you are looking for, but I try to give you some hints and please, share if I misunderstood something.

If you ant to learn about Docker and Docker Desktop, you can go to the “Learning Center” in Docker Desktop. If you know how Docker and containers in general works, the interface of Docker Desktop will be much easier to understand.

The Dev Environment could be useful, but I wouldn’t start with that as a first step. A Dev Environment means you will work inside a container which is inside the vitual machine of Docker Desktop and you use Visual Studio Code to connect to the remote container (in the VM). I also know from the past that now all projects were recognized by Docker Desktop which could have happened to you.

Containerizing a software can be very hard or relatively easy depending on the exact project. You need t learn about the Dockerfile which describes how an image should be created and the Docker Compose which let’s you describe the parameters of multiple containers in one or more yaml files.

If the webapp is already dockerized, then you either have an image that you can download from a registry or a sourcecode (I guess this is the case) which contains the Dockerfile and the compose file. Then you just start Docker Desktop, and open a powershell window in the project folder, then probably run docker compose up -d, but it all depends on the project itself so I can’t give you the final solution here.

Ok so from what it sounds like Docker Desktop is completely useless. What is the purpose of Docker Desktop if I’m just doing everything inside PowerShell anyway? I would have never known that I needed PowerShell on top of Docker Desktop. It sounds like I need to uninstall Desktop because it does not provide me with a clean GUI version of docker which is the only reason I thought I would be able to use it instead of having to learn the Docker Commands.

Again, I know nothing about your projects. There are plenty of youtube videos and tutorials about Docker Desktop that show the benefit of Docker Desktop like using extensions to add more funcionality or run Kubernetes single-node cluster easily, search for Docker images, start containers, check the logs, execute commands in containers or backup volumes but it won’t help if you have no idea what to look for.

You will still need to use powershell or command line if you want to build a Docker image or start a compose project, but on Windows Docker Desktop is the easiest way to instal Docker to run Linux containers. You could install Docker CE in a virtual machine, but then you couldn’t use Docker Desktop extensions or start run Kubernetes with just a couple of clicks.

I prefer to use Docker CE on Linux, but I use Docker Desktop on my MacBook, although not for the GUI.
Since I don’t use Docker Desktop on Windows frequently, I can’t share the best video tutorial, but here is one:

This is about an older version, but the basics are the same. You can also hear about extenions from this video:

If you want to know why you should or should not use Docker Desktop, you will need to share more information about the project.

Was that one person? Can you ask that person what they meant by that?

I guess I’m getting somewhere now maybe the source code i was given is also broken.

PS C:\Users\Home> cd .\Documents\web-app\drive-main\drive-main
PS C:\Users\Home\Documents\web-app\drive-main\drive-main> docker compose up -d
parsing C:\Users\Home\Documents\web-app\drive-main\drive-main\docker-compose.yml: yaml: line 9: did not find expected ‘-’ indicator
PS C:\Users\Home\Documents\web-app\drive-main\drive-main>

Possible. Are you allowed to share the compose file? It is called docker-compose.yml probably.

I guess I don’t see why the project details matter. I would expect any “Desktop” version of a software to be the GUI version of the command line. Similar to git vs git gui. Why can’t I use Docker Desktop to compose an image?

I have no idea what Kubernetes is. I have a project that appears to use node.js and is completely written in TypeScript. Beyond that I don’t know what to do with it because I can’t even load it to see what it is doing. I have reached out to the person that gave me the project but they no longer work at the company and have been fairly unreliable in getting information from them. They also don’t really help much when I do get them to respond.

I come from an embedded devices background so I’m familiar with programming and development but Docker is a different cup of tea for me. I actually was looking at the compose file and found a random “j” at the end of line 9 removing that cleared up my first error but now I’m getting this:

PS C:\Users\Home\Documents\web-app\drive-main\drive-main> docker compose up -d
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_ROOT" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_ROOT" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_FILE_PATH" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_ROOT" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_ROOT" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "CERT_ROOT" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "NGINX_DRIVE_CONF" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "NGINX_BASE_CONF" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_ROOT" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "MONGO_DB_DATA_PATH" variable is not set. Defaulting to a blank string.”
time=“2023-06-27T15:00:28-06:00” level=warning msg=“The "DRIVE_ROOT" variable is not set. Defaulting to a blank string.”
invalid mount config for type “bind”: field Source must not be empty
PS C:\Users\Home\Documents\web-app\drive-main\drive-main>

I’m sure that means my environment is not setup correctly. Is that not part of the dockerfile or some other config in the project?

Because we don’t fully understand the error messages if we don’t understand what generates the error message. We can guess, but we would very quickly stop guessing due to the lack of time. Since you admitted that you haven’t used Docker before, it gets even harder to help you because you would not understand our answer.

It is hard to compare Git and Docker although there are similarities in the concept, but I am not sure that you can do everything from the Git GUI at all. Maybe you just didn’t needed anything more complex that would require the terminal. I know that VirtualBox had some configurations that I couldn’t do using the GUI only using VBoxManage, but I understand that you mean the basic commands should be supported by the GUI. Docker Desktop is evolving constantly, so we discussed some missing features before and someone even implemented it partially in a Docker Desktop Extension, shared on the forum and later the original missing feature was implemented directly in Docker Desktop (searching for images on Docker Hub). You can expect more support in the future, but supporting docker compose up -d from the GUI is not as easy as it seems I guess. Docker Desktop for example has a “Containers” tab which recognizes Docker Compose projects, but I had some errors before because I think I started the project from the terminal which creates containers first and stopped Docker Desktop and later I used Docker Desktop to start the same project (already existing containers) and it couldn’t start properly because I had relative paths or something in the compose file and Docker Desktop didn’t know what the actual context should have been. When a GUI has to support everything that is possible to do from a terminal it becomes so complicated that it also becomes hard to use. Docker is not for GUI applications so we have to be familiar with the terminal anyway when we need to investigate issues inside the container or just want to write commands in the Dockerfile or even in the compose file.

You cans till ask for support in the Hub Feedback repository

For example Docker Inc could implement a feature to browse the compose file, set the context and some basic parameters assuming everything else is coded in the project. For now, you can pull images, start containers from images, stop and start existing containers, check the logs, check and delete volumes, create backups or use extensions. Some of the extensions might have features that you miss. The Portainer extensions for example can manage compose projects, but you need to be aware of what Docker Desktop is. It was created to provide the same experience on each platform which is almost impossible, but they tried. Everything is running in a virtual machine in order to have the same virtualized environment to support the Docker Engine, so when you run a docker command, you actually communicate with a remote Docker daemon. When you want to use mounted folders from your filesystem, Docker needs to mount the files from the phyisical host into the virtual machine and you coudln’t access the containers’ ip addresses directly because of the virtualization.

As you can probably see know, if we don’t know what your requirements are, we can’t tell you what you should do. Docker Desktop can be great, but originally the main purpose was not the GUI but supporting Linux containers on Windows which is not possible without virtualization.

It depends. A Dockerfile can contain environment variables and the when developers create the Dockerfile with default values, but sometimes default valiues don’t make sense so you need to define those when you start the container. You can also define variables in the compose file and override variables defined in the Dockerfile. Then you can also have a file called .env an define variables there and use those variables in the compose file to provide values to parameters in the compose file. And I could talk about it for long how many ways you can use these files. Sometimes we create shell scripts when the compose command is not enough and we can define variables there too. IT is again something that would be hard to support in Docker DEsktop directly.

Without seeing the source code there is no way to tell you what you need to do and if you can’t explain the requirements because the one person that understood it is not working for the company anymore, the communication will become hard and you will feel we can’t help you. Even though you are familiar with programming not even all programming languages are similar enough to understand just because we used other languages. Docker is also something which requires skills that sometimes even experienced develoeprs don’t have and they need to hire someone who can work with Docker. I was originally hired for similar reasons at the company I work for and they already had someone who worked with containers.

So telling you that you just need to start Docker Desktop and start to develop is not really helpful. It requires much more preparation and learning. If the project you want to start had a good documentation or a sample configuration that you can just start, you could at least try the current version.

Ok Thanks for the responses. As of right now even following the tutorial I can’t get the getting-started project to run correctly. It just sends an empty response.

I’m not comparing Git to Docker. But I still think having a GUI that doesn’t do the most basic of operations for a software is not needed. A GUI is supposed to be the easy way of doing things so that people who don’t know all of the intricacies of the software have visual help in doing what they need.

I am not just familiar with programming I have over 15 years experience developing windows software, embedded devices, and web applications of various sorts. I understand that languages are different but I’m not currently struggling with a language I’m struggling with a piece of software that is supposedly user friendly and essential to development which so far has been nothing but the barrier that is impeding any development that I could be doing for almost a week now.

Based on your very lengthy explanation (which I do appreciate and I’m very grateful for the time you’ve donated to help me get starting) I don’t understand why anybody uses Docker. I’ve never come across anything where even the “hello world/getting-started” example was not something that just worked with out any problems. And based on my searches I’ve found many examples of people having the same problem: [here for example.](https://forums.docker.com/t/err-empty-response-with-getting-started-tutorial/135544/3) and there are many more.

I agree with you that the explanation I have been given of the project is completely unhelpful. I am extremely unhappy with how this former employ has handed off the project and the lack of documentation I have. I still do not even have access to the entirety of the project as we have other parts that interface with different servers that I still need to get.

I will say that this experience has made it so that I don’t think I will ever be using Docker in the future and I’ll be trying to find a way to make this project somethin that does not use Docker so that nobody has to deal with the apparent wide open requirements and possibilities. I want something that I can maintain without the headache of something so convoluted that it becomes completely unintuitive and useless.

I will continue to bang my head against a wall until the getting-started provided by the Docker Development team magically decides that it will work out of the box…

Thanks for your time.

I responded in the other topic. I leave the link here too for others: https://forums.docker.com/t/docker-webserver-cannot-be-reached/136608/10?u=rimelek

I am sorry, I didn’t mean that you are “just” familiar, by familiar I meant you are experienced, but even if someone has many years of experience in multiple kind of programming, containerization will still be new and a GUI will not be able to hide all the difficulties. It has a GUI to manage settings and discover images, containers and so on, but I don’t think it was ever the goal to be used by people who know nothing about containers. It just makes it a little easier to manage containers and start a new container, but not from compose (or not yet). Even the Dev Environment feature is still beta for a long time now.

I have heard that question from many people who heard about containers and tried the first time. Then they learned more about it and started it to make sense. It takes time. Forcing a project to run in a container without anyone in the team understanding it just because it is popular is wrong as much as allowing an employee to work on a project for a long time without proper documentation. Docker is powerful but it can powerfully “destroy” the project when it is developed and operated with the mindset of running softwares the traditional way. There is nothing wrong with running applications without containers if the developers and system administrators are not experienced Docker users. Using containers for the first time when there is not enough time to learn about that is really frustrating and gives you the impression as you had that Docker is basically useless and overcomplicated, although it is not the case. You just need someone to develop the Docker part or consult with you because even Docker experts will not neccesserily be expert in the required programming. Then if you have a Docker image that someone already created, and you get a yml file that was also created by someone else, you can basically copy and paste it and the application will most likely work because a container contains everything that the software required and you are not restrictied to use a specific Linux distribution on the host, because the container will contain that distribution and all you need is a compatible Linux kernel.

I don’t want to convince you about using Docker. It won’t help everyone, but in the long run, if you don’t have to do everything alone and you get proper documentation it can be extremely useful. Until that, if you have time to learn, you will need patiance, but if you don’t have time or just not interested in this yet, it is fully understandable if you go back to the well-known, stable way, if you can at the current stage of the project.

I myself had to realise recently that I was not enough for a specific solution in a project and it would have been irresponsible to stick with that when I took over the project so I chose another way that can be done easier by a single person.

Hi @fatdollar, I feel your frustration. @rimelek has done a great job of trying to explain things to you but as he said, “if you don’t understand Docker, then you won’t understand our answers”. Let’s take a different approach and deal with your current errors.

I get that you can’t share the docker-compose.yml file with us because it’s part of an internal project at your company. From your last error message it looks like your docker-compose.yml file requires the following environment variables which you have not defined.

DRIVE_ROOT
DRIVE_FILE_PATH
CERT_ROOT
NGINX_DRIVE_CONF
NGINX_BASE_CONF
MONGO_DB_DATA_PATH

Best practice is to place these in a file called .env in the same folder as the docker-compose.yml file but best practice also says not to check the .env file into version control because it is unique to your computer and probably won’t work with someone elses. It may also contain secrets, like passwords, that you don’t want in version control.

I would ask the previous developer for their .env file or at least to tell you what values to use for these environment variables. Then paste them into a .env file and try again. That should get you closer.

Why use Docker?

As to why use Docker? I teach Docker in my graduate course on DevOps and Agile Methodologies at NYU. All of the labs for my course use Docker to give my students a reproducible development environment. I do this using Visual Studio Code and Docker Desktop with the DevContainer extension. That’s all students need to install. Each lab has different tools installed but students don’t have to deal with this. They simply bring up VSCode, Re-Open in Container, and the lab is ready to go.

It looks like the previous developer did not use this approach and kind of “hacked” something together with docker commands that you are now stuck dealing with. It doesn’t have to be this hard, but someone has to set it up initially and it looks like that someone is now you.

Don’t give up. Once you get those environment variables, let us know what the next error is, or if you achieved success. Good Luck!

1 Like

Thanks for you response. And to be honest this person that I replaced does have the “hack it together” mentality. Coming from my experience I’ve never seen so many things that were just “made to work” vs creating a repeatable solution. 5 days ago they finally responded to my email about the errors and said I’ll look into it. I still have nothing. I’ll definitely keep you posted.

I am honestly considering just completely restarting the project but I know we don’t have time for that as a company.

Seriously I have no idea what is going wrong…I have started from scratch on a linux server running ubuntu 22.04 and completely up to date. I’m simply trying to run the getting started tutorial found here.

However, the app doesn’t even seem to start:

user:~/getting-started$ sudo docker run -dp 127.0.0.1:3000:3000 getting-started
ecb083018a58f1a461a1b6078ddfb2feae0923f2c0fbea2866921bcdf06050b4
user:~/getting-started$ sudo docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
user:~/getting-started$

If I try to run:

sudo docker run -dp 3000:3000 getting-started

I’m not able to access it remotely (ERR_CONNECTION_REFUSED) and I get the same output for

docker ps

which tells me that no container is running. I realize I may not be starting the container correctly for accessing the page from outside the server and I have opened the port 3000 so its not a firewall problem from what I can tell.

I must be Docker Kryptonite because nothing works for me. I copied the tutorial commands directly from the webpage linked above and didn’t type any of them by hand so it can’t be my fat fingers this time.

Any thoughts?..I would hate to have to resort to finding a mac as I refuse to use Apple products but at this point I’m 0 for 2 with the other operating systems…and the server we are hosting this app on eventually is a linux server so ultimately i have to have it work on linux.

I just went through that tutorial and I cut-n-paste everything just as you did and this is what I got:

app % docker run -dp 127.0.0.1:3000:3000 getting-started
7de591eadd8379e5fbabcb5542635c4925484cd50a9d38de508cac28f0a95514
app % docker ps
CONTAINER ID   IMAGE             COMMAND                  CREATED         STATUS         PORTS                      NAMES
7de591eadd83   getting-started   "docker-entrypoint.s…"   6 seconds ago   Up 4 seconds   127.0.0.1:3000->3000/tcp   optimistic_lamarr
app %

I have to admit that the tutorial is a bit confusing. It has you clone a repo but then you need to change into the app folder to create the Dockerfile. I missed that at first. (you may have too) :slight_smile:

Any thoughts?

Make sure you are building the docker image from the correct folder. From your error messages I see that you are in the getting-started folder. You should be in the getting-started/app folder.

I believe this is the problem. so…

git clone https://github.com/docker/getting-started.git
cd getting-started/app
touch Dockerfile  <-- then edit this file
docker build -t getting-started .
sudo docker run -dp 127.0.0.1:3000:3000 getting-started

…and see if that works. :crossed_fingers:

1 Like

@rofrano Thank you that definitely helped.

I can now see the getting started running on the localhost. However, I can’t open a browser on the server as I don’t have a GUI and only a bash screen. I will definitely take this as a win since something is happening now.

I have 2 questions:

  1. I understand now that when the tutorial says the app directory it was meaning getting-started/app. The part that confused me is that I see a Dockerfile in getting-started/. So what’s got me confused is what all the docker stuff is in the root directory. Why is the example I’m working on so buried and why can’t the repository just have the app directory to avoid the confusion. I’m guessing there are reasons but they are not apparent to me.

  2. Seeing as I don’t have a local browser how do I put this so that i can externally access the app? Since this is ultimately my end goal anyway I figure this is the next logical step.

I’m going to also try your fix on the Windows machine since I very sure I was in the wrong folder there too. I will also continue on with the tutorial since.

As an update to the errors on the company project. Over the weekend I heard from the person and they said they would look into the missing variables. Here we are a week later and I haven’t heard anything. So I’ll just keep crossing my fingers.

Update: This was my problem on the windows tutorial. I’m able to pull up the webpage on localhost now.

In seems we were all confused by that fact so something could definitely be better, however, the root folder contains the sourcecode of the getting started tutorial web page too and it just has a subfolder with a sourcecode which could be used so you don’t have to write the nodejs code, only the Dockerfile. I would have made a separate repository.

Just remove the ip address part. Assuming that there is no firewall blocking the request, it should work:

sudo docker run -dp 3000:3000 getting-started
  1. Why is the example I’m working on so buried and why can’t the repository just have the app directory to avoid the confusion. I’m guessing there are reasons but they are not apparent to me.

You would have to ask the creator of the tutorial. It makes no sense to me either. A tutorial should have only what is necessary to teach the lesson and no more. They have obviously violated this and confused even me and I teach Docker at the university level!

  1. Seeing as I don’t have a local browser how do I put this so that i can externally access the app? Since this is ultimately my end goal anyway I figure this is the next logical step.

You could use X-Windows and export your display but this is probably more trouble than it’s worth (especially on Windows). I would work locally instead of remote. Working remotely is adding a whole layer of complications that you don’t need. I think from your edit you did get this working locally. Bravo! :smiley:

Suggestion

I suggest you try and set up Visual Studio Code with the Devcontainers extension. I teach this to my students in the second lecture of my DevOps course before I even teach them Docker. So you don’t really need to know Docker to use it. You are just a consumer of Docker at this point. I believe it will help you set up the repeatable environment you need to develop with and you can learn Docker later.

You might want to watch this video series from Microsoft on setting up and using the Devcontainer environment:

It became way easier on Windows, since WLS comes with WSLg. It has been around for Win11 for a long time, and finally found its way into Win10. It allows running x-applications with ease: there is no need to install or configure anything special to use it. WSLg injects a x11 Unix socket (owned by a system distribution running wayland) into started distributions, which then renders started applications in rdp sessions on the host desktop.

I run intellij like this, because their remoting solutions (there are a couple of ways that could be used) feel inferior compared to Visual Studio Code’s remoting solution.

Furthermore, WSL has support to enable systemd with ease, which would allow to install and use docker-ce inside a WSL distribution.

@rofrano @meyay I’m lost. Did I miss something? I’m not sure why we are talking about wslg and x-windows. :slight_smile: I thought the goal was to access a web service and the container was bound to the local IP (on a server).

Since this topic was originally about Docker Desktop, I guess that could be the reason of the misunderstanding.
In case of Docker Desktop when a local port can’t be forwarded from the host, I would use a firefox container which contains a remote desktop server which can be accessed from a web browser on the host: linuxserver/firefox

My bad, I knew my post was off-topic, but I still couldn’t resist :blush:

It just provides an alternative solution on how to develop and use docker in Windows.