Code Monkey home page Code Monkey logo

rust-docker-image's Introduction

Rust Docker Image

Docker Pulls

Docker Hub | GitHub Container Registry | Quay.io

Supported tags and respective Dockerfile links

stable

Mirrors official rust Docker images.

beta

nightly

Mirrors official rust-lang/rust:nightly Docker images, but preserves versions for each date.

What is Rust?

Rust is a systems programming language sponsored by Mozilla Research. It is designed to be a "safe, concurrent, practical language", supporting functional and imperative-procedural paradigms. Rust is syntactically similar to C++, but is designed for better memory safety while maintaining performance.

rust-lang.org

wikipedia.org/wiki/Rust_(programming_language)

Rust Logo

How to use this image

Start a Rust instance running your app

The most straightforward way to use this image is to use a Rust container as both the build and runtime environment. In your Dockerfile, writing something along the lines of the following will compile and run your project:

FROM instrumentisto/rust:beta

WORKDIR /usr/src/myapp
COPY . .

RUN cargo install --path .

CMD ["myapp"]

Then, build and run the Docker image:

$ docker build -t my-rust-app .
$ docker run -it --rm --name my-running-app my-rust-app

Compile your app inside the Docker container

There may be occasions where it is not appropriate to run your app inside a container. To compile, but not run your app inside the Docker instance, you can write something like:

$ docker run --rm --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp instrumentisto/rust:beta cargo build --release

This will add your current directory, as a volume, to the container, set the working directory to the volume, and run the command cargo build --release. This tells Cargo, Rust's build system, to compile the crate in myapp and output the executable to target/release/myapp.

Image tags

The instrumentisto/rust images come in many flavors, each designed for a specific use case.

<version>

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

Some of these tags may have names like buster or bullseye in them. These are the suite code names for releases of Debian and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Debian.

This tag is based off of buildpack-deps. buildpack-deps is designed for the average user of Docker who has many images on their system. It, by design, has a large number of extremely common Debian packages. This reduces the number of packages that images that derive from it need to install, thus reducing the overall size of all images on your system.

<version>-slim

This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run rust. Unless you are working in an environment where only the instrumentisto/rust image will be deployed and you have space constraints, we highly recommend using the default image of this repository.

<version>-alpine

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.

To minimize image size, it's uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

License

View license information for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

The sources for producing instrumentisto/rust Docker images are licensed under Blue Oak Model License 1.0.0.

Issues

We can't notice comments/reviews in the Docker Hub so don't use them for reporting issue or asking question.

If you have any problems with or questions about this image, please contact us through a GitHub issue.

rust-docker-image's People

Contributors

dependabot[bot] avatar tyranron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alexlapa

rust-docker-image's Issues

error: failed to run custom build command for `proc-macro2 v1.0.37`

When running:

podman run --rm
-v cargo-cache:/volume/.cargo
-v $PWD:/volume
-w /volume
-t quay.io/instrumentisto/rust
cargo build --release

I get the this error:

Running cmd: just compile
info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'
info: latest update on 2022-04-07, rust version 1.60.0 (7737e0b5c 2022-04-04)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
Updating crates.io index
Updating git repository [https://github.com/paperclip-rs/paperclip.git](https://github.com/paperclip-rs/paperclip.git%60)
Updating git submodule [https://github.com/swagger-api/swagger-ui](https://github.com/swagger-api/swagger-ui%60)
Downloading crates ...
Downloaded flate2 v1.0.23
Downloaded futures-core v0.3.21
Downloaded generic-array v0.14.5
Downloaded form_urlencoded v1.0.1
Downloaded foreign-types-shared v0.1.1
Downloaded foreign-types v0.3.2
Downloaded fnv v1.0.7
Downloaded h2 v0.3.13
Downloaded firestorm v0.5.0
Downloaded hashbrown v0.11.2
Downloaded fast_chemail v0.9.6
Downloaded http v0.2.6
Downloaded httpdate v1.0.2
Downloaded http-body v0.4.4
Downloaded hyper-timeout v0.4.1
Downloaded mime v0.3.16
Downloaded memchr v2.4.1
Downloaded percent-encoding v2.1.0
Downloaded pkg-config v0.3.25
Downloaded proc-macro-error-attr v1.0.4
Downloaded proc-macro-error v1.0.4
Downloaded ppv-lite86 v0.2.16
Downloaded rand_core v0.6.3
Downloaded rand_chacha v0.3.1
Downloaded regex v1.5.5
Downloaded regex-automata v0.1.10
Downloaded prometheus v0.13.0
Downloaded pin-utils v0.1.0
Downloaded tokio v1.17.0
Downloaded tracing-core v0.1.26
Downloaded sharded-slab v0.1.4
Downloaded yaml-rust v0.4.5
Downloaded thiserror v1.0.30
Downloaded tinyvec_macros v0.1.0
Downloaded futures-io v0.3.21
Downloaded futures-sink v0.3.21
Downloaded gethostname v0.2.3
Downloaded futures-task v0.3.21
Downloaded futures v0.3.21
Downloaded actix-http v3.0.4
Downloaded futures-util v0.3.21
Downloaded local-waker v0.1.2
Downloaded futures-macro v0.3.21
Downloaded tracing-bunyan-formatter v0.3.2
Downloaded tracing-attributes v0.1.20
Downloaded utoipa v0.1.2
Downloaded utoipa-gen v0.1.2
Downloaded version_check v0.1.5
Downloaded self_cell v0.10.2
Downloaded schemars_derive v0.8.8
Downloaded sha-1 v0.10.0
Downloaded tracing-opentelemetry v0.17.2
Downloaded time-macros v0.2.4
Downloaded semver v1.0.7
Downloaded protobuf v2.27.1
Downloaded tinyvec v1.6.0
Downloaded schemars v0.8.8
Downloaded rand v0.8.5
Downloaded slab v0.4.6
Downloaded semver v0.11.0
Downloaded unicode-bidi v0.3.8
Downloaded zstd-safe v4.1.4+zstd.1.5.2
Downloaded zeroize v1.5.4
Downloaded zstd v0.10.0+zstd.1.5.2
Downloaded unicode-normalization v0.1.19
Downloaded tokio-util v0.7.1
Downloaded uuid v0.8.2
Downloaded tower-service v0.3.1
Downloaded tower-http v0.2.5
Downloaded num_cpus v1.13.1
Downloaded openssl-sys v0.9.72
Downloaded tokio-native-tls v0.3.0
Downloaded opentelemetry-prometheus v0.10.0
Downloaded opentelemetry-semantic-conventions v0.9.0
Downloaded num_threads v0.1.5
Downloaded num-traits v0.2.14
Downloaded ordered-float v2.10.0
Downloaded minijinja v0.15.0
Downloaded nom v4.2.3
Downloaded miniz_oxide v0.5.1
Downloaded memo-map v0.3.1
Downloaded num-integer v0.1.44
Downloaded native-tls v0.2.10
Downloaded openssl-probe v0.1.5
Downloaded language-tags v0.3.2
Downloaded kube-runtime v0.71.0
Downloaded mio v0.8.2
Downloaded getrandom v0.2.6
Downloaded include_dir v0.7.2
Downloaded hostname v0.1.5
Downloaded tower-layer v0.3.1
Downloaded tower v0.4.12
Downloaded tokio-io-timeout v1.2.0
Downloaded tokio-stream v0.1.8
Downloaded tracing-subscriber v0.3.11
Downloaded tokio-openssl v0.6.3
Downloaded paste v1.0.7
Downloaded once_cell v1.10.0
Downloaded libc v0.2.124
Downloaded base64 v0.13.0
Downloaded encoding_rs v0.8.31
Downloaded pin-project-internal v1.0.10
Downloaded pem v1.0.2
Downloaded cfg-if v1.0.0
Downloaded cc v1.0.73
Downloaded openapiv3 v1.0.1
Downloaded byteorder v1.4.3
Downloaded bitflags v1.3.2
Downloaded chrono v0.4.19
Downloaded crc32fast v1.3.2
Downloaded autocfg v1.1.0
Downloaded anyhow v1.0.57
Downloaded crossbeam-channel v0.5.4
Downloaded ansi_term v0.12.1
Downloaded aho-corasick v0.7.18
Downloaded dashmap v4.0.2
Downloaded derivative v2.2.0
Downloaded heck v0.4.0
Downloaded instant v0.1.12
Downloaded indexmap v1.8.1
Downloaded either v1.6.1
Downloaded dirs-sys-next v0.1.2
Downloaded dirs-next v2.0.0
Downloaded crossbeam-utils v0.8.8
Downloaded parking_lot_core v0.8.5
Downloaded urlparse v0.7.3
Downloaded itoa v1.0.1
Downloaded itertools v0.10.3
Downloaded parking_lot v0.12.0
Downloaded parking_lot v0.11.2
Downloaded lazy_static v1.4.0
Downloaded adler v1.0.2
Downloaded tokio-util v0.6.9
Downloaded pin-project v1.0.10
Downloaded openssl v0.10.38
Downloaded darling_macro v0.13.4
Downloaded bufstream v0.1.4
Downloaded actix-utils v3.0.0
Downloaded alloc-stdlib v0.2.1
Downloaded block-buffer v0.10.2
Downloaded ascii_utils v0.9.3
Downloaded actix-service v2.0.2
Downloaded ahash v0.7.6
Downloaded bytestring v1.0.0
Downloaded convert_case v0.4.0
Downloaded crypto-common v0.1.3
Downloaded cpufeatures v0.2.2
Downloaded async-trait v0.1.53
Downloaded base64 v0.10.1
Downloaded http-range-header v0.3.0
Downloaded dyn-clone v1.0.5
Downloaded darling v0.13.4
Downloaded backoff v0.4.0
Downloaded actix-server v2.1.1
Downloaded alloc-no-stdlib v2.0.3
Downloaded actix-web-codegen v4.0.0
Downloaded actix-router v0.5.0
Downloaded hyper-openssl v0.9.2
Downloaded cookie v0.16.0
Downloaded actix-web v4.0.1
Downloaded digest v0.10.3
Downloaded actix-rt v2.7.0
Downloaded actix-macros v0.2.3
Downloaded actix-codec v0.5.0
Downloaded json-patch v0.2.6
Downloaded bytes v1.1.0
Downloaded kube v0.71.0
Downloaded darling_core v0.13.4
Downloaded jobserver v0.1.24
Downloaded ipnet v2.5.0
Downloaded derive_more v0.99.17
Downloaded kube-core v0.71.0
Downloaded actix-web-opentelemetry v0.12.0
Downloaded syn v1.0.91
Downloaded serde_derive_internals v0.25.0
Downloaded proc-macro2 v1.0.37
Downloaded quote v1.0.18
Downloaded lock_api v0.4.7
Downloaded kube-client v0.71.0
Downloaded urlencoding v2.1.0
Downloaded try-lock v0.2.3
Downloaded treediff v3.0.2
Downloaded tracing-futures v0.2.5
Downloaded pin-project-lite v0.2.9
Downloaded httparse v1.7.0
Downloaded brotli-decompressor v2.3.2
Downloaded linked_hash_set v0.1.4
Downloaded kube-derive v0.71.0
Downloaded local-channel v0.1.2
Downloaded tokio-macros v1.7.0
Downloaded lettre v0.9.6
Downloaded futures-channel v0.3.21
Downloaded futures-executor v0.3.21
Downloaded time v0.3.9
Downloaded thread_local v1.1.4
Downloaded thiserror-impl v1.0.30
Downloaded strum_macros v0.24.0
Downloaded strum v0.24.0
Downloaded strsim v0.10.0
Downloaded include_dir_macros v0.7.2
Downloaded socket2 v0.4.4
Downloaded parking_lot_core v0.9.2
Downloaded want v0.3.0
Downloaded zstd-sys v1.6.3+zstd.1.5.2
Downloaded jsonpath_lib v0.3.0
Downloaded idna v0.2.3
Downloaded version_check v0.9.4
Downloaded url v2.2.2
Downloaded unicode-xid v0.2.2
Downloaded ucd-trie v0.1.3
Downloaded typenum v1.15.0
Downloaded tracing-log v0.1.3
Downloaded tracing-actix-web v0.5.1
Downloaded smallvec v1.8.0
Downloaded signal-hook-registry v1.4.0
Downloaded tracing v0.1.34
Downloaded serde_yaml v0.8.23
Downloaded serde_urlencoded v0.7.1
Downloaded serde_json v1.0.79
Downloaded serde_derive v1.0.136
Downloaded serde-value v0.7.0
Downloaded serde v1.0.136
Downloaded semver-parser v0.10.2
Downloaded secrecy v0.8.0
Downloaded scopeguard v1.1.0
Downloaded ryu v1.0.9
Downloaded rustversion v1.0.6
Downloaded rustc_version v0.4.0
Downloaded reqwest v0.11.10
Downloaded regex-syntax v0.6.25
Downloaded pest v2.1.3
Downloaded opentelemetry v0.17.0
Downloaded matches v0.1.9
Downloaded matchers v0.1.0
Downloaded log v0.4.16
Downloaded linked-hash-map v0.5.4
Downloaded ident_case v1.0.1
Downloaded hyper-tls v0.5.0
Downloaded hyper v0.14.18
Downloaded brotli v3.3.4
Downloaded k8s-openapi v0.14.0
Compiling proc-macro2 v1.0.37
error: failed to run custom build command for proc-macro2 v1.0.37

Caused by:
could not execute process /volume/target/release/build/proc-macro2-c762b5a643d7a9fa/build-script-build (never executed)

Caused by:
Network dropped connection on reset (os error 102)

Host:
uname -amn
Darwin 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64

Podman info --debug:

host:
arch: arm64
buildahVersion: 1.24.3
cgroupControllers:

  • cpuset
  • cpu
  • io
  • memory
  • pids
  • misc
    cgroupManager: systemd
    cgroupVersion: v2
    conmon:
    package: conmon-2.1.0-2.fc36.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
    cpus: 1
    distribution:
    distribution: fedora
    variant: coreos
    version: "36"
    eventLogger: journald
    hostname: localhost.localdomain
    idMappings:
    gidmap: null
    uidmap: null
    kernel: 5.17.3-300.fc36.aarch64
    linkmode: dynamic
    logDriver: journald
    memFree: 1371586560
    memTotal: 2052624384
    networkBackend: netavark
    ociRuntime:
    name: crun
    package: crun-1.4.4-1.fc36.aarch64
    path: /usr/bin/crun
    version: |-
    crun version 1.4.4
    commit: 6521fcc5806f20f6187eb933f9f45130c86da230
    spec: 1.0.0
    +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
    os: linux
    remoteSocket:
    exists: true
    path: /run/podman/podman.sock
    security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
    serviceIsRemote: true
    slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.aarch64
    version: |-
    slirp4netns version 1.2.0-beta.0
    commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
    libslirp: 4.6.1
    SLIRP_CONFIG_VERSION_MAX: 3
    libseccomp: 2.5.3
    swapFree: 0
    swapTotal: 0
    uptime: 2h 0m 52.86s (Approximately 0.08 days)
    plugins:
    log:
  • k8s-file
  • none
  • passthrough
  • journald
    network:
  • bridge
  • macvlan
    volume:
  • local
    registries:
    search:
  • docker.io
    store:
    configFile: /usr/share/containers/storage.conf
    containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
    graphDriverName: overlay
    graphOptions:
    overlay.mountopt: nodev,metacopy=on
    graphRoot: /var/lib/containers/storage
    graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
    imageCopyTmpDir: /var/tmp
    imageStore:
    number: 2
    runRoot: /run/containers/storage
    volumePath: /var/lib/containers/storage/volumes
    version:
    APIVersion: 4.0.3
    Built: 1648837359
    BuiltTime: Fri Apr 1 14:22:39 2022
    GitCommit: ""
    GoVersion: go1.18
    OsArch: linux/arm64
    Version: 4.0.3

What am I missing?

thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.