Rust-Mini docker rust: mini-docker-rust — An example project for very small rust docker images

mini-docker-rust travis

Very small rust docker image.

This is an example project on how to build very small docker images for a rust project. The resulting image for a working hello world was about 8.1MB during my tests.

See for yourself

You don't need to install anything besides docker. Build with docker build -t mini-docker-rust . and run with docker run mini-docker-rust.

Annotated docker file

See Dockerfile.

Comments

  • Fix for alpine:latest
    Fix for alpine:latest

    Dec 9, 2017

    libgcc is required for rust on alpine 3.7

    Reply
  • Switch to alpine:latest
    Switch to alpine:latest

    Jun 29, 2017

                                                                                                                                                                                                           
    Reply
  • Add travis build
    Add travis build

    Apr 28, 2017

                                                                                                                                                                                                           
    Reply
  • Corrected README.md docker command.
    Corrected README.md docker command.

    Apr 30, 2017

    From a newbie in rust and Docker.
    Seems to me that the second docker command in the README should be a run and not a build.

    Reply
  • A multi-stage example
    A multi-stage example

    Sep 14, 2019

    Hi!

    Docker features multi-stage builds nowadays: https://docs.docker.com/develop/develop-images/multistage-build/

    This pretty much lets you create a temporary build image, then copy an artifact from the build image over to your actual target image, all in one Dockerfile. Have you considered that approach? I got the same size from that, but I feel the Dockerfile is "cleaner".

    [email protected]:~/code/mini-docker-rust$ docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED              SIZE
    mdrr                    latest              6dbc2cd0676e        11 seconds ago       7.52MB
    mdr                     latest              0f65f756e698        9 minutes ago        7.52MB
    <snip>
    
    Reply