Skip to content

--frozen is not equivalent to specifying both --locked and --offline #15239

Closed
@wegylexy

Description

@wegylexy

Problem

This fails:

cargo install --path . --frozen
0.389   Installing myapp v0.1.0 (/app)
0.472     Updating crates.io index
0.493 error: attempting to make an HTTP request, but --frozen was specified

This works:

cargo install --path . --locked --offline

Steps

FROM rust:alpine AS deps
WORKDIR /app
RUN apk add --no-cache build-base openssl-dev
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && \
    echo "fn main() {}" > src/main.rs && \
    cargo build --release && \
    rm -rf src

FROM deps AS build
COPY src src
RUN cargo install --path . --frozen

FROM alpine:latest AS publish
COPY --from=build /usr/local/cargo/bin/myapp /usr/local/bin/
ENTRYPOINT [ "myapp" ]
docker build -t myapp .

Possible Solution(s)

Specify both --locked and --offline instead of --frozen.

Notes

Environment is Docker Desktop on WSL2

Version

cargo 1.85.0 (d73d2caf9 2024-12-31)
release: 1.85.0
commit-hash: d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7
commit-date: 2024-12-31
host: x86_64-unknown-linux-musl
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Alpine Linux 3.21.3 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-offlineArea: offline modeC-bugCategory: bugS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions