Can I use Docker like this ...? - docker

My work laptop is running LinuxMint as the base OS, plus Virtualbox to run Windows 7 which is the actual work environment, usually plus an additional Virtualbox VM to run a different Windows installation in which I do my client project work (I have one VM per client, to avoid messing up my main OS).
But I'm wondering if it's feasible and beneficent to switch to using Docker for the client project stuff? That is, I'd like to keep LinuxMint (to preserve my sanity), and keep Windows ('cause I have to use some MS products), but then instead of that series of "client VM's" use Docker containers?
I'm not entirely clear on how containers are useful. Can I, for instance, have a container in which I've installed dotNET and MS SQL; and then another container where I've installed an Azure Powershell; and a third container where I've installed Java and Eclipse -- and then decide which of these "sets" of software is available on the same common base OS (Windows, with VPN and Outlook and Notepad++)?
This post makes me think I'm asking for a solution from the wrong tool?
Or should I perhaps attack the root problem from a different angle, and ask the following over at Workplace.SE: How to work as a consultant without "cluttering up" one's (Windows) OS with more or less temporary installations of all sorts of software necessary for client projects?

AFAIK there is no WindowsOS ready to be run INSIDE a docker container localy, but they are anounced. See www.docker.com/microsoft and msdn windowscontainers
What you can do is run Linux OSs in docker containers within Windows. But in your case you should run the docker engine in your Mint Linux

Not really an answer, more like several comments -- though it's too long to fit within a comment
First of all I would not run Mint, but that's off the question.
Then, it may probably worth to take a look at How is Docker different from a normal virtual machine?.
Also, as you linked, Docker does not aim (at all) to run several programs. Indeed, their policy is Caas: Container as a Service. So basically one program per container. Saying all that, you can probably run wine within container and run one application on each container (over wine).
Have fun!

Related

Can we debug .NET desktop apps in Docker container

(The more I dig this, the more confusing it gets. I have found Windows images available to download, but none of them appears to be the standard desktop OS)
Is there a way to debug my .NET Framework or .NET Core/5/6 desktop application (WinForms, WPF, VSTO) in a Docker container running Windows 10? I'm just trying to setup a playground environment that I could put together quickly and test my code.
For my own notes and any future beginner, here is my current finding:
Docker is not a full-fledged virtual machine like what we get with VirtualBox, VMWare etc. It's more like a process in an isolated environment, called a Container. For example you could create a container that runs an instance of MySQL, or a container that runs an instance of NodeJS. Of course there are images containing Operating System too, such as Ubuntu, Alpine or even Windows, but those images do not contain the full desktop environment; they are just the base OS services.
So answering the question, no, this is not (currently?) possible at least for Windows. People have had success running Ubuntu desktop inside a Docker container, but that is an advanced topic and only works in Linux-based containers. I haven't seen anything like that for Windows.

what programs can be installed in a docker container

I am a Windows user.
I have looked at the official Docker tutorial "Get Started". The example focus is a python app. I don't know python and I guess a Docker container can have many programs installed as an environment, not just python.
Is Docker good for testing a program I download from the internet in an isolated environment (like a sandbox in firewalls or antivirus) ?
How for example can I make a container that has an environment containing installed programs like Visual Studio, VLC player, Office, etc.?
Thanks,
Abe
Yes; you can have an isolated environment with docker. You can set your desired configurations, download from internet, install, and whatever you do in a Virtual Machine.
Yes, you can. What your container contains depends on the base image you create it FROM and packages you install inside of it.
Tips
You can build your container from an empty OS (e.g. ubuntu), configure the OS, download/install/configure/run whatever you want.
You can create a base image which derives FROM a suitable OS, then install any basic application (e.g. firefox) which you may use in a lot of containers on it. Then you should push it in a registry (e.g. Github). After that, you can use it as a base image for other containers, so your new containers have installed applications by default; no need to install them again. It reduces complexity and repetitions in Dockerfile.

Docker on Windows in Production

I've been asked to research Docker. The question that I cannot get a definitive response to is "can you run Docker on Windows in production?".
I keep seeing "Docker image containers can run natively on Linux and Windows. However, Windows images can run
only on Windows hosts and Linux images can run only on Linux hosts, meaning a host server or a VM."
I'm not interested in running containerized windows applications (.net). We have Spring Boot (java) applications & are creating a microservices architecture. These containerized apps. don't need an OS running in the same container.
We also need an orchestration engine like Kubernetes and its unclear if this is something that can run in production on windows either.
I've been fighting the good fight trying to get deployment environments switched to Linux but that's a loosing battle at this point.
Citing the docs:
Welcome to Docker for Windows!
Docker is a full development platform for creating containerized apps,
and Docker for Windows is the best way to get started with Docker on
Windows systems.
Take this literally. It's meant by the vendor as a dev tool to develop your Docker environment on Windows, not a production environment. To run it in production, they expect a Linux host.
It's not clear if the OP is asking "Can I run Docker on Windows in production" (like from a licensing perspective), or "should I run it" (like from an experience perspective.) I have an answer that should address both points.
It's indeed interesting to note first that as I write this, all the answers and comments so far are from 2018 or (like the question) 2017.
Here's at least one 2019 post on the topic from Docker (including listing clients running in production, so it addresses both points):
https://www.docker.com/blog/5-reasons-to-containerize-production-windows-apps-on-docker-enterprise/
And while the title refers to Docker Enterprise, the article does say "Hundreds of enterprises now run Windows container nodes in production", without that Enterprise caveat.
Even so, folks who may "not want to pay to run Docker Enterprise" should note that Windows 2016 and 2019 include a license of Docker Enterprise, free. (As for the recent upheaval of Docker where the Enterprise product was sold to Mirantis, there's no indication yet that will change the included Windows licensing of it.)
Still, I realize that the OP and other readers may seek still more (documented) evidence of production Docker deployment on Windows. I'll leave that for others to elaborate. Just didn't think this should stand here without anything more recent than July 2018.
Check out this blog, it quotes "Windows Server 2016 is the where Docker Windows containers should be deployed for production".
First of all, I suspect this question is rather stale after 3 years. I don't know if you are still struggling with the problem, I would love to hear your experience and the route you had taken.
This is probably a biased answer but I will try to answer with my experience. Like you, we have also lost the good fight to persuade our client to use a Linux server. We have 2 metals and a small bunch of virtual machines running Windows Server 2019 - Server version 1809 (Which is not the cutting edge, but the most recent stable version) It was indeed an improvement on top of WS2016. However it still had some problems. The major problem was with the docker swarm. The overlay networking with routing mesh was not working properly. So we had to fall back to containers with docker-compose and manual service discovery, which kinda beats the purpose of docker.
That being said, the problem with the Swarm network could be because of the fact that we are using virtual machines and Hyper-v switches. On top of that, we had no direct access to host network and we had to jump through some bureaucratic hoops whenever we require changes in the network, which got super old super fast when we want to test stuff. Additionally, we did not have Active Directory because of our lack of confidence to network. I am still not sure if DCs would play with docker in a virtual environment. Still not having AD was manageable since we did not have many machines.
Another problem was that we did not have nested virtualization (i.e. cannot run moby) due to CPU issues, and WSL2 with support for Docker is not available on WS19 LTSC editions. So I had to write our own images for many stuff that we use. Like Jenkins, Redis, etc. You can find the dockerfiles here if interested But obviously keeping them up to date and tidy was a huge work and I did not have much time to invest.
Performance-wise, we seemed to have no issues but we did not really make a comparative analysis.
All in all, I love Docker, it is a great product. But after this project I am thinking not to touch Docker on windows in a production environment with a 10 foot pole. In fact, I don't know if I will ever use a Windows machine as production environment in the future. It is cool to have it in development though.
My understanding is that Containers on Windows Server should be fine for production while Containers on Windows Desktop should be only for dev and test, not production. I saw one post "MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE FOR WINDOWS CONTAINER BASE IMAGE" https://learn.microsoft.com/en-us/virtualization/windowscontainers/images-eula, not sure how this one is related to this question?
I can highly recommend not to use Docker Desktop for Windows in Production.
The host machines (Windows 10 Pro) where configured to restart everyday at a certain time and the Docker Container where Linux containers which as recommended where using the WSL2 based engine.
I was testing it on 20 devices for a over one year now and from 20 Pc's had at least 5 now the problem that Docker Desktop cannot be initialized. Which means that Docker Desktop is not starting anymore until you remove some folder(s) in %APPDATA% but when you do so it worked only 3 out of 5 times for me that Docker Desktop was able to start after that. One time needed to reinstall Docker Desktop the remaining One I needed to reload all the docker images and configure them again. Most of the issues seemed to have been a result of a power cut.
Most annoying are the updates from my perspective, because from one to the other version all images and running containers where gone and I needed to reconfigure them, happend with 2 Version in the past but not on all computer.
The Linux machines on the other hand no issues.

How do you run an .exe file on Docker?

I am currently trying to understand and learn Docker. I have an app, .exe file, and I would like to run it on either Linux or OSX by creating a Docker. I've searched online but I can't find anything allowing one to do that, and I don't know Docker well enough to try and improvise something. Is this possible? Would I have to use Boot2Docker? Could you please point me in the right direction? Thank you in advance any help is appreciated.
Docker allows you to isolate applications running on a host, it does not provide a different OS to run those applications on (with the exception of a the client products that include a Linux VM since Docker was originally a Linux only tool). If the application runs on Linux, it can typically run inside a container. If the application cannot run on Linux, then it will not run inside a Linux container.
An exe is a windows binary format. This binary format incompatible with Linux (unless you run it inside of an emulator or VM). I'm not aware of any easy way to accomplish your goal. If you want to run this binary, then skip Docker on Linux and install a Windows VM on your host.
As other answers have said, Docker doesn't emulate the entire Windows OS that you would need in order to run an executable 'exe' file. However, there's another tool that may do something similar to what you want: "Wine" app from WineHQ. An abbreviated summary from their site:
Wine is a compatibility layer capable of running Windows applications
on several operating systems, such as Linux and macOS.
Instead of simulating internal Windows logic like a virtual
machine or emulator, Wine translates Windows API calls
on-the-fly, eliminating the performance and memory penalties of
other methods and allowing you to cleanly integrate Windows
applications into your desktop.
(I don't work with nor for WineHQ, nor have I actually used it yet. I've only heard of it, and it seems like it might be a solution for running a Windows program inside of a light-weight container.)

Development environment in Docker

Due to a hardware issue, I had to change my work station to another Mac for a few weeks.
It took me a couple of hours to setup everything: Android Studio, git, Apache, MySql, etc...
Could I use a docker image to bundle all my development tools ?
(My goal is to have a "backup" of my development environment that I could start running right away on another machine)
Could I use a docker image to bundle all my development tools ?
That means all your dev tools would be Linux tools working in Linux container, on a Linux host.
You would need to provide that Linux host (on your Mac) through a boot2docker Virtual Machine.
But that also mean you could not directly type "git" from a Mac shell, you would need to connect to your VM first in order to launch your 'git' container and run dome docker run --name=git commands.
So no, this doesn't seem to be a good fit for your backup plan on Mac.
Not necessarily. It kinda depends what you are looking for in a development environment.
I do use it for part of my dev env though.
Vagrant + Docker
My personal approach is to rely on Vagrant to fire up a bunch of environments, some of which being full-fledged VMs and others being lightweight containers.
This is a rather controversial approach though, many people would not agree with it, as the tools overlap, both in terms of platform capability and provisioning.
Docker Containers for 3rd Party Services
My personal approach for this is to use Vagrant to fire up a bunch of different VMs, where one is my main dev VM with tools I use for development (IDEs, editors, SCM tools, etc...), and the rest are Docker containers for 3rd party apps that relate to my daily activities (IRC client, database servers like MySQL or MongoDB, etc...).
This fits my cycle decently as these types of tools (like databases) are not something you generally interact with directly through a tty, but something I'd rather connect to with another tool via an API. So I don't need direct access to them, and I do want them to be isolated and easy to jumpstart and dispose of when I jump between projects.
So, docker containers fit part of my idea of a dev environment, but not necessarily all of it.
Just my use case though. Hope it helps.
Shameless plug: Docker Shell
This tool lets you set up a uniform cross platform development environment inside a docker container.
http://dockershell.io/

Resources