Issue
The aim is to have a Docker CLI in a Container, so I can Communicate with the Host Daemon from within this Container. Therefore I wanted to connect the socket's in the run Command.
I have a Dockerfile with the following start. The rest of the build works fine when I omit the Curl and Docker CLI part.
FROM ubuntu:20.04 as build
#might be even more slim, yet has not yet been tested: debian-stable-slim
RUN apt-get update \
&& apt-get install -y wget
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && \
apt-get install curl
## Install Docker CLI:
ENV DOCKERVERSION=20.10.9
RUN sudo curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
This is the build log with error message:
[+] Building 3.2s (8/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 567B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 1.2s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [1/5] FROM docker.io/library/ubuntu:20.04@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 0.0s
=> CACHED [2/5] RUN apt-get update && apt-get install -y wget 0.0s
=> CACHED [3/5] RUN apt-get update && apt-get -y install sudo 0.0s
=> ERROR [4/5] RUN apt-get update && apt-get install curl 1.9s
------
> [4/5] RUN apt-get update && apt-get install curl:
#8 0.395 Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
#8 0.415 Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
#8 0.441 Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
#8 0.517 Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
#8 0.623 Reading package lists...
#8 1.142 Reading package lists...
#8 1.631 Building dependency tree...
#8 1.733 Reading state information...
#8 1.836 The following additional packages will be installed:
#8 1.836 krb5-locales libasn1-8-heimdal libbrotli1 libcurl4 libgssapi-krb5-2
#8 1.836 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
#8 1.836 libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3 libkeyutils1
#8 1.836 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#8 1.836 libnghttp2-14 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
#8 1.836 libsasl2-modules-db libsqlite3-0 libssh-4 libwind0-heimdal
#8 1.837 Suggested packages:
#8 1.837 krb5-doc krb5-user libsasl2-modules-gssapi-mit
#8 1.837 | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
#8 1.837 libsasl2-modules-sql
#8 1.866 The following NEW packages will be installed:
#8 1.867 curl krb5-locales libasn1-8-heimdal libbrotli1 libcurl4 libgssapi-krb5-2
#8 1.867 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
#8 1.867 libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3 libkeyutils1
#8 1.867 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#8 1.868 libnghttp2-14 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
#8 1.869 libsasl2-modules-db libsqlite3-0 libssh-4 libwind0-heimdal
#8 1.874 0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
#8 1.874 Need to get 3197 kB of archives.
#8 1.874 After this operation, 10.5 MB of additional disk space will be used.
#8 1.874 Do you want to continue? [Y/n] Abort.
------
executor failed running [/bin/sh -c apt-get update && apt-get install curl]: exit code: 1
there is no possibility to choose Y/n, because it exits instantly. Has anyone a Idea how to solve this?
Im Using Docker on Windows, Version 20.10.8
Thanks a lot!
Solution
apt get install
will wait for user input. You're missing the -y
flag to allow it to continue without human intervention:
RUN apt-get update && \
apt-get install -y curl
Answered By - Mureinik