<p>Developing a service to test in a docker container is always tricky because you have to have systemd (or whatever) running as your base process to keep the container up.  There are ways around it, but I think it's usually better to test the code you're writing as the main process rather than test it as a service.</p>
<p>Just remember, you're not testing systemd.</p>
<p>For that kind of stuff I'd use vagrant rather than docker. Your CI/CD tools probably won't care too much although it'll use more resources.</p>

CC BY-SA 4.0
2023-08-29T20:46:58.233Z
2023-08-29T20:46:58.233Z
Peter Turner
<p>In addition to Peter comments, I would like to add that you should think even more about your objective than the tool. If your goal is to deploy a system on a linux machine. Docker is not going to show you all the problems you might have using Linux Native.</p>
<p>Without knowing all its requirements I would say that a SubSystem can show you better and prepare you better for this case, or really Vagrant, I'm talking about the subsystem because you probably already have it in your Windows, just activate it.</p>

CC BY-SA 4.0
2023-08-30T07:16:38.687Z
Do you mean Windows System for Linux (WSL)? If that, then I do have it activated.
Max
CC BY-SA 4.0
2023-08-31T18:32:37.187Z
That's right, this feature!
Enderson Menezes
CC BY-SA 4.0
2023-08-29T21:51:36.473Z
2023-08-29T21:51:36.473Z
Enderson Menezes
<p>I'm new to docker and I want to start using it in the following scenario.</p>
<p>For example, I need to implement an Asp.Net Core Web API and deploy it to a linux system. The development is done on a Windows machine in Visual Studio. My idea is to create a docker image which mimics the target linux system, develop the service and test it in a docker image and then deploy it to the target system without docker.</p>
<p>In other words, I'm going to use docker for the development process, but the application is not going to be containerized in the production.</p>
<p>Is it a reasonable scenario or am I doing something wrong?</p>
<p><strong>Update:</strong></p>
<p>Perhaps I was misleading in using the term &quot;service&quot;. I didn't mean linux service. What I really meant was Asp.Net Core web service.</p>
<p>I also considered using WSL, but I would need to install additional  software like NGINX to test the application. Usually I use a virtual machine (VMWare) in this case. I prepare the target environment in a virtual machine and test my application there, so I don't have to pollute my host system. But virtual machines have a lot of overhead, so I thought that using docker was going to be less taxing.</p>

<docker><linux><dotnet>
Using docker as a substitute for VM for testing
Max
# Using docker as a substitute for VM for testing

(Asked by: username_0 on 2023-08-29)

I'm new to docker and I want to start using it in the following scenario.

For example, I need to implement an Asp.Net Core Web API and deploy it to a linux system. The development is done on a Windows machine in Visual Studio. My idea is to create a docker image which mimics the target linux system, develop the service and test it in a docker image and then deploy it to the target system without docker.

In other words, I'm going to use docker for the development process, but the application is not going to be containerized in the production.

Is it a reasonable scenario or am I doing something wrong?

**Update:**

Perhaps I was misleading in using the term "service". I didn't mean linux service. What I really meant was Asp.Net Core web service.

I also considered using WSL, but I would need to install additional software like NGINX to test the application. Usually I use a virtual machine (VMWare) in this case. I prepare the target environment in a virtual machine and test my application there, so I don't have to pollute my host system. But virtual machines have a lot of overhead, so I thought that using docker was going to be less taxing.

**Tags:** docker, linux, dotnet


---

## 2 answers

### Answer by username_1 on 2023-08-29. Score: 0

Developing a service to test in a docker container is always tricky because you have to have systemd (or whatever) running as your base process to keep the container up. There are ways around it, but I think it's usually better to test the code you're writing as the main process rather than test it as a service.

Just remember, you're not testing systemd.

For that kind of stuff I'd use vagrant rather than docker. Your CI/CD tools probably won't care too much although it'll use more resources.


---

### Answer by username_2 on 2023-08-29. Score: 0

In addition to Peter comments, I would like to add that you should think even more about your objective than the tool. If your goal is to deploy a system on a linux machine. Docker is not going to show you all the problems you might have using Linux Native.

Without knowing all its requirements I would say that a SubSystem can show you better and prepare you better for this case, or really Vagrant, I'm talking about the subsystem because you probably already have it in your Windows, just activate it.

> **Comments:**
> **username_0**: Do you mean Windows System for Linux (WSL)? If that, then I do have it activated.  
> **username_2**: That's right, this feature!  

---

