여기에 설명된 대로 간단한 도커 이미지를 만들려고 합니다.http://lethalman.blogspot.com/2016/04/cheap-docker-images-with-nix_15.html, 하지만 빌드 단계에서는 네트워크/인터넷 액세스가 없는 것 같습니다. 이것이 제한 사항입니까? 해결책이 있나요?
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
entrypoint = writeScript "entrypoint.sh" ''
#!${stdenv.shell}
set -e
exec "$@"
'';
in
dockerTools.buildImage {
name = "test";
runAsRoot = ''
#!${stdenv.shell}
${dockerTools.shadowSetup}
curl google.com
'';
contents = [ busybox bash curl ];
config = {
Cmd = [ "bash" ];
Entrypoint = [ entrypoint ];
#ExposedPorts = {
#"6379/tcp" = {};
#};
WorkingDir = "/data";
#Volumes = {
#"/data" = {};
#};
};
}
컬은 display 에서 실패합니다 curl: (6) Could not resolve host: google.com
. (DNS를 피하기 위해) IP를 대신 사용할 때도 작동하지 않습니다. 전체 출력:
nix build --no-substitute
builder for '/nix/store/6md5l4lhk4kb5i8b3sp7w3q5v1nd83m2-docker-layer-test.drv' failed with exit code 6; last 10 log lines:
Writing superblocks and filesystem accounting information: done
Executing pre-mount steps...
Adding contents...
Adding /nix/store/xhwhakb1zcf5wl2a8575gcrnmbbqihm2-busybox-1.30.1...
Adding /nix/store/rm1hz1lybxangc8sdl7xvzs5dcvigvf7-bash-4.4-p23...
Adding /nix/store/a7i4hha4gh7fsbw7bfz51l2dkhgvb59a-curl-7.65.3-bin...
Executing post-mount steps...
curl: (6) Could not resolve host: google.com
[ 3.476402] reboot: Power down
cannot build derivation '/nix/store/k4dz6c5xv1p430wai75yigmmw8yn9kzy-docker-layer-test.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/pk4s3nzdv3kd2gxfqr72bimvvam7h469-docker-image-test.tar.gz.drv': 1 dependencies couldn't be built
[1 built (1 failed)]
error: build of '/nix/store/pk4s3nzdv3kd2gxfqr72bimvvam7h469-docker-image-test.tar.gz.drv' failed