Skip to content

Convert a Docker image to an executable

License

Notifications You must be signed in to change notification settings

xehartnort/docker2exe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker2exe

This tool can be used to convert a Docker image to an executable that you can send to your friends!

Installation

Minimal dependencies are:

  • A linux-based OS such as ubuntu, compiling is not supported on Windows and untested in Mac OS
  • A working go environment with version >=1.18
  • pigz

To compile, just run make and executables for each platform will be generated in dist/ folder.

Usage

To create a new binary:

$ docker2exe --name alpine --image alpine:3.9

This will create the following files:

dist
├── alpine-darwin-amd64
├── alpine-linux-amd64
├── alpine-windows-amd64

Now, you can run the executable:

$ dist/alpine-darwin-amd64 cat /etc/alpine-release
3.9.5

When the executable is run, we'll check for the alpine:3.9.5 image on the user's system. If it doesn't exist, the executable will automatically run:

$ docker pull alpine:3.9.5

Embedded Mode

In this mode, if the specified image doesn't exist, we'll attempt to load it from a tarball that is embeddded in the executable.

$ docker2exe --name alpine --image alpine:3.9 --embed

When creating the executable above, the image was dumped to a tarball and baked into the resulting executable:

$ docker save alpine:3.9 | gzip > alpine.tar.gz

When the executable runs, we'll check for the alpine:3.9 image on the user's system. If it doesn't exist, the executable will automatically run:

$ docker load alpine.tar.gz

For small images, this approach works great. In the example above, the resulting executable was under 10MB.

About

Convert a Docker image to an executable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 89.6%
  • Makefile 10.4%