Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
356 views
in Technique[技术] by (71.8m points)

Distributing Docker micro-service based web app as a standalone executable

I have a project that uses Docker Compose to package mysql, Keycloak, and an html front end. The application was originally intended for multiple users but desire has been expressed to use it like a standalone desktop executable application. I was wondering if something like Electron could provide a means to accomplish this.

Does any have any experience packaging a Docker-based web application as a standalone desktop applcation? How feasible and difficult might it be?

question from:https://stackoverflow.com/questions/65943880/distributing-docker-micro-service-based-web-app-as-a-standalone-executable

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's not really feasible:

  • The end user would have to have the Docker runtime installed, which isn't a normal external dependency for a desktop application;
  • The setup to run GUI applications in Docker is complicated and very platform-dependent (on non-Linux you need extra host-side software);
  • Running Docker containers requires administrator-level permissions, since you can use a bind mount to edit arbitrary files on the host, but desktop applications don't usually have that.

(In principle you could work around all of these things, but Docker is intended to run as a system daemon and isn't designed to be embedded in other applications.)

The most straightforward packaging approach for this would be to publish the images to Docker Hub or another publicly-accessible repository, and to publish the docker-compose.yml file that launches the containers. Then an end user would need to install Docker, download the docker-compose.yml file, run docker-compose up -d, and point their browser to a specific URL to reach the front-end. That's less user-friendly than a standalone installer, but it is a small specific set of steps to run the application.

If you can restructure the application to use an embedded database like SQLite, and as a desktop application you don't need a federated login system, then you could also probably rebuild this whole thing as a native Electron application, without involving Docker at all.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...