bottlerocket-os / bottlerocket-os/bottlerocket

Unable to build project inside a docker container

Open
#4,100 6 comments 0 reactions 0 assignees View on GitHub
status/needs-triage type/bug
Dominant language
Rust
Stars
9.7k
Forks
586
Avg merge
1d 18h
Merged PRs (30d)
12

Description

Hi folks,

I'm working on building out some Bottlerocket OS variants (this is related to Kata Container work). As a first step, I'm attempting to build the project as-is, with zero changes, exactly as the docs state.

I've deployed a fresh c7a.8xlarge instance in one of our dev AWS accounts and I'm using it for initial development. I'm able to build the project (thanks for your help Matt!) just fine when running directly on this EC2 instance/VM, but not from within a container image. Also as a side note, the build instructions are missing `curl` as a dependency which is required by the twoliter setup script.

Here is a (long) two-line command to reproduce the issue, which should be sufficient to show that this isn't due to something cached or pre-existing state of some form:
```shell
# Ensure that the docker daemon state is completely empty/"clean"
# This build process shares the docker daemon, so for reproducablility
# purge everything to show that there isn't an issue due to
# something cached
docker system prune -a -f

# Do the full build
docker run --rm -it -v "/var/run/docker.sock:/var/run/docker.sock" ubuntu sh -c 'apt update && apt install -y --no-install-recommends docker.io && docker image ls && apt install -y build-essential openssl libssl-dev pkg-config liblz4-tool && apt install -y rustup && rustup install stable ; cargo install cargo-make && apt install -y --no-install-recommends git && git clone https://github.com/bottlerocket-os/bottlerocket.git && cd bottlerocket && cargo make'
```

This is pretty difficult to read, so here's what the build shell command broken down in a less copy-pastable format:
```shell
apt update

# Install the docker CLI inside the image
apt install -y --no-install-recommends docker.io
docker image ls # This should show nothing, but succeed, and is just here for demonstration purposes

# From BUILDING.md
apt install -y build-essential openssl libssl-dev pkg-config liblz4-tool

# Install rust and cargo, which is not explicitly spelled out in the BUILDING.md doc but is implied by the `cargo` command
apt install -y rustup
rustup install stable || true # This has a non-zero exit code just because `rustup` is installed via apt instead of the rust download script

# From BUILDING.md
cargo install cargo-make

# Clone the project and build it
apt install -y --no-install-recommends git
git clone https://github.com/bottlerocket-os/bottlerocket.git && cd bottlerocket
cargo make
```

This fails with:
```
[cargo-make] INFO - cargo make 0.37.14
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: install-twoliter
Installing Twoliter from binary release.
[cargo-make] INFO - Execute Command: "/bottlerocket/tools/twoliter/twoliter" "--log-level=info" "fetch" "--project-path=/bottlerocket/Twoliter.toml" "--arch=x86_64"
[2024-07-22T23:23:38Z WARN twoliter::project] A Release.toml file was found. Release.toml is deprecated. Please remove it from your project.
d618d229d249: Already exists

public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:d618d229d249805986d1760db6683c6ce039a7c83748cfc66796ffaaafef498f
[cargo-make] INFO - Running Task: install-twoliter
Found Twoliter v0.4.3 installed.
Skipping installation.
[cargo-make] INFO - Execute Command: "/bottlerocket/tools/twoliter/twoliter" "--log-level=info" "make" "default" "--project-path=/bottlerocket/Twoliter.toml" "--cargo-home=/bottlerocket/.cargo" "--"
[2024-07-22T23:24:33Z WARN twoliter::project] A Release.toml file was found. Release.toml is deprecated. Please remove it from your project.
[cargo-make][1] INFO - Calling cargo metadata to extract project info
[cargo-make][1] INFO - Cargo metadata done
[cargo-make][1] INFO - Build File: /bottlerocket/build/tools/Makefile.toml
[cargo-make][1] INFO - Task: default
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Running Task: setup
[cargo-make][1] INFO - Running Task: setup-build
[cargo-make][1] INFO - Running Task: fetch-sdk
d0aab6231274: Download complete
982dc8e9a597: Download complete
b3c10008bdf0: Download complete
4f4fb700ef54: Download complete
03f448bcfe71: Download complete
public.ecr.aws/bottlerocket/bottlerocket-sdk:v0.42.0
[cargo-make][1] INFO - Running Task: fetch-sources
Updating crates.io index
Updating git repository `https://github.com/bottlerocket-os/bottlerocket-settings-sdk`
Downloaded darling_macro v0.14.4
Downloaded windows-targets v0.48.5
Downloaded pin-project-lite v0.2.13
Downloaded tstr_proc_macros v0.2.2
Downloaded windows-targets v0.52.4
Downloaded is-terminal v0.4.12
Downloaded ident_case v1.0.1
Downloaded darling_macro v0.20.8
Downloaded autocfg v1.1.0
Downloaded unindent v0.1.11
Downloaded abi_stable_shared v0.11.0
Downloaded tokio-tungstenite v0.20.1
Downloaded tinyvec v1.6.0
Downloaded pest_meta v2.7.8
Downloaded cargo-readme v3.3.1
Downloaded idna v0.5.0
Downloaded gimli v0.28.1
Downloaded web-sys v0.3.69
Downloaded slab v0.4.9
Downloaded handlebars v4.5.0
Downloaded winapi v0.3.9
Downloaded http v0.2.12
Downloaded encoding_rs v0.8.33
Downloaded maplit v1.0.2
Downloaded envy v0.4.2
Downloaded anstyle-parse v0.2.3
Downloaded anstyle-query v1.0.2
Downloaded windows-sys v0.52.0
Downloaded windows-sys v0.48.0
Downloaded winapi-i686-pc-windows-gnu v0.4.0
Downloaded winapi-x86_64-pc-windows-gnu v0.4.0
Downloaded anstyle-wincon v3.0.2
Downloaded colorchoice v1.0.0
Downloaded utf8parse v0.2.1
Downloaded anstream v0.6.13
Downloaded clap_builder v4.5.2
Downloaded clap_derive v4.5.3
Downloaded ring v0.17.8
Downloaded clap v4.5.3
Downloaded tokio v1.32.1
Downloaded windows_aarch64_msvc v0.52.4
Downloaded windows_i686_gnu v0.52.4
Downloaded windows_i686_msvc v0.52.4
Downloaded windows_x86_64_gnu v0.52.4
Downloaded windows_x86_64_msvc v0.52.4
Downloaded windows_aarch64_msvc v0.48.5
Downloaded windows_i686_gnu v0.48.5
Downloaded windows_i686_msvc v0.48.5
Downloaded windows_x86_64_gnu v0.48.5
Downloaded windows_x86_64_msvc v0.48.5
Downloaded regex-automata v0.4.6
Downloaded libc v0.2.153
Downloaded nix v0.26.4
Downloaded rustls v0.21.11
Downloaded windows_aarch64_gnullvm v0.52.4
Downloaded windows_x86_64_gnullvm v0.52.4
Downloaded windows_aarch64_gnullvm v0.48.5
Downloaded windows_x86_64_gnullvm v0.48.5
Downloaded abi_stable v0.11.3
Downloaded syn v2.0.66
Downloaded ucd-trie v0.1.6
Downloaded sha2 v0.10.8
Downloaded simplelog v0.12.2
Downloaded shlex v1.3.0
Downloaded addr2line v0.21.0
Downloaded cc v1.0.90
Downloaded rustc-demangle v0.1.23
Downloaded num_cpus v1.16.0
Downloaded tokio-macros v2.1.0
Downloaded serde_plain v1.0.2
Downloaded form_urlencoded v1.2.1
Downloaded unicode-bidi v0.3.15
Downloaded cached_proc_macro v0.20.0
Downloaded cached_proc_macro_types v0.1.1
Downloaded futures-channel v0.3.30
Downloaded futures-io v0.3.30
Downloaded futures-sink v0.3.30
Downloaded futures-task v0.3.30
Downloaded pin-utils v0.1.0
Downloaded pest v2.7.8
Downloaded block-buffer v0.10.4
Downloaded generic-array v0.14.7
Downloaded futures-util v0.3.30
Downloaded object v0.32.2
Downloaded socket2 v0.5.6
Downloaded tinyvec_macros v0.1.1
Downloaded unicode-normalization v0.1.23
Downloaded percent-encoding v2.3.1
Downloaded url v2.5.0
Downloaded data-encoding v2.5.0
Downloaded num-integer v0.1.46
Downloaded num-bigint v0.4.4
Downloaded der-parser v9.0.0
Downloaded synstructure v0.13.1
Downloaded asn1-rs-impl v0.2.0
Downloaded displaydoc v0.2.4
Downloaded num-traits v0.2.18
Downloaded asn1-rs v0.6.1
Downloaded minimal-lexical v0.2.1
Downloaded nom v7.1.3
Downloaded rusticata-macros v4.1.0
Downloaded thiserror-impl v1.0.58
Downloaded thiserror v1.0.58
Downloaded deranged v0.3.11
Downloaded powerfmt v0.2.0
Downloaded time-core v0.1.2
Downloaded time-macros v0.2.17
Downloaded time v0.3.34
Downloaded x509-parser v0.16.0
Downloaded argh_derive v0.1.12
Downloaded argh v0.1.12
Downloaded futures-core v0.3.30
Downloaded pin-project-internal v1.1.5
Downloaded pin-project v1.1.5
Downloaded heck v0.5.0
Downloaded snafu-derive v0.8.3
Downloaded snafu v0.8.3
Downloaded same-file v1.0.6
Downloaded walkdir v2.5.0
Downloaded anyhow v1.0.81
Downloaded hex v0.4.3
Downloaded memoffset v0.7.1
Downloaded tokio-util v0.7.10
Downloaded h2 v0.3.26
Downloaded http-body v0.4.6
Downloaded httpdate v1.0.3
Downloaded hyper v0.14.28
Downloaded hyper-rustls v0.24.2
Downloaded ipnet v2.9.0
Downloaded openssl-probe v0.1.5
Downloaded schannel v0.1.23
Downloaded security-framework-sys v2.9.1
Downloaded security-framework v2.9.2
Downloaded rustls-native-certs v0.6.3
Downloaded serde_urlencoded v0.7.1
Downloaded core-foundation v0.9.4
Downloaded core-foundation-sys v0.8.6
Downloaded system-configuration v0.5.1
Downloaded rustls-webpki v0.101.7
Downloaded spin v0.9.8
Downloaded sct v0.7.1
Downloaded tokio-rustls v0.24.1
Downloaded wasm-bindgen-futures v0.4.42
Downloaded js-sys v0.3.69
Downloaded bumpalo v3.15.4
Downloaded wasm-bindgen-backend v0.2.92
Downloaded wasm-bindgen-macro v0.2.92
Downloaded wasm-bindgen v0.2.92
Downloaded winreg v0.50.0
Downloaded reqwest v0.11.26
Downloaded signal-hook-registry v1.4.1
Downloaded signal-hook v0.3.17
Downloaded byteorder v1.5.0
Downloaded httparse v1.8.0
Downloaded sha1 v0.10.6
Downloaded utf-8 v0.7.6
Downloaded tungstenite v0.20.1
Downloaded regex-syntax v0.8.2
Downloaded darling_core v0.20.8
Downloaded serde v1.0.203
Downloaded serde_json v1.0.117
Downloaded pest_generator v2.7.8
Downloaded pest_derive v2.7.8
Downloaded base64 v0.21.7
Downloaded typenum v1.17.0
Downloaded crypto-common v0.1.6
Downloaded backtrace v0.3.69
Downloaded bytes v1.5.0
Downloaded mio v0.8.11
Downloaded futures v0.3.30
Downloaded instant v0.1.12
Downloaded cached v0.49.2
Downloaded dns-lookup v2.0.4
Downloaded anstyle v1.0.6
Downloaded clap_lex v0.7.0
Downloaded strsim v0.11.0
Downloaded cpufeatures v0.2.12
Downloaded digest v0.10.7
Downloaded adler v1.0.2
Downloaded miniz_oxide v0.7.2
Downloaded asn1-rs-derive v0.5.0
Downloaded oid-registry v0.7.0
Downloaded num_threads v0.1.7
Downloaded argh_shared v0.1.12
Downloaded hyper-unix-connector v0.2.2
Downloaded try-lock v0.2.5
Downloaded mime v0.3.17
Downloaded rustls-pemfile v1.0.4
Downloaded sync_wrapper v0.1.2
Downloaded system-configuration-sys v0.5.0
Downloaded untrusted v0.9.0
Downloaded wasm-bindgen-shared v0.2.92
Downloaded wasm-bindgen-macro-support v0.2.92
Downloaded darling_core v0.14.4
Downloaded tracing-core v0.1.32
Downloaded tracing v0.1.40
Downloaded humantime v2.1.0
Downloaded log v0.4.21
Downloaded aho-corasick v1.1.2
Downloaded regex v1.10.3
Downloaded wasi v0.11.0+wasi-snapshot-preview1
Downloaded getrandom v0.2.12
Downloaded rand v0.8.5
Downloaded once_cell v1.19.0
Downloaded zerocopy-derive v0.7.32
Downloaded zerocopy v0.7.32
Downloaded ahash v0.8.11
Downloaded allocator-api2 v0.2.16
Downloaded hashbrown v0.14.3
Downloaded indexmap v2.2.5
Downloaded memchr v2.7.1
Downloaded winnow v0.6.5
Downloaded toml_edit v0.22.14
Downloaded toml v0.8.14
Downloaded syn v1.0.109
Downloaded abi_stable_derive v0.11.3
Downloaded const_panic v0.2.8
Downloaded core_extensions v1.5.3
Downloaded crossbeam-utils v0.8.19
Downloaded crossbeam-channel v0.5.12
Downloaded lock_api v0.4.11
Downloaded redox_syscall v0.4.1
Downloaded parking_lot_core v0.9.9
Downloaded parking_lot v0.12.1
Downloaded semver v1.0.22
Downloaded strsim v0.10.0
Downloaded darling v0.20.8
Downloaded num-conv v0.1.0
Downloaded want v0.3.1
Downloaded tower-service v0.3.2
Downloaded tracing-attributes v0.1.27
Downloaded hermit-abi v0.3.9
Downloaded winapi-util v0.1.6
Downloaded termcolor v1.4.1
Downloaded env_logger v0.10.2
Downloaded ppv-lite86 v0.2.17
Downloaded rand_chacha v0.3.1
Downloaded rand_core v0.6.4
Downloaded version_check v0.9.4
Downloaded serde_spanned v0.6.6
Downloaded toml_datetime v0.6.6
Downloaded as_derive_utils v0.11.0
Downloaded typed-arena v2.0.2
Downloaded generational-arena v0.2.9
Downloaded libloading v0.7.4
Downloaded bitflags v1.3.2
Downloaded paste v1.0.14
Downloaded tstr v0.2.4
Downloaded repr_offset v0.2.2
Downloaded ryu v1.0.17
Downloaded proc-macro2 v1.0.85
Downloaded unicode-ident v1.0.12
Downloaded serde_derive v1.0.203
Downloaded async-trait v0.1.78
Downloaded darling v0.14.4
Downloaded core_extensions_proc_macros v1.5.3
Downloaded smallvec v1.13.1
Downloaded fnv v1.0.7
Downloaded lazy_static v1.4.0
Downloaded equivalent v1.0.1
Downloaded rustc_version v0.4.0
Downloaded itoa v1.0.10
Downloaded quote v1.0.36
Downloaded scopeguard v1.2.0
Downloaded cfg-if v1.0.0
Downloaded 265 crates (42.6 MB) in 2.20s (largest was `ring` at 4.2 MB)
[cargo-make][1] INFO - Running Task: fetch-vendored
[cargo-make][1] INFO - Running Task: check-licenses
2024-07-22 23:26:17 [ERROR] the directory /tmp/sources doesn't contain a Cargo.toml file
Error while executing command, exit code: 1
Error: Command was unsuccessful, exit code 105
Error while executing command, exit code: 1
```

This exits with exit code `105`.

**Platform I'm building on:** Ubuntu 24.04 (host and container image)

**What I expected to happen:** `cargo make` to succeed when ran inside a container

**What actually happened:** It failed with exit code 105 (see logs above)

**How to reproduce the problem:** See above

Contributor guide

Open the contributing guide

Research direction

Start with BUILDING.md, the root Makefile.toml, and the cargo make install-twoliter task; reproduce the provided docker run command and compare it with the successful host build. Trace the failure after Twoliter begins fetching the SDK and sources, then verify whether the missing curl dependency is part of the same issue. Done means the container build succeeds or the documented blocker and required dependency are corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, rust
Domain
build-system, devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.