λ docker build --no-cache --build-arg "host_uid=$(id -u)" --build-arg "host_gid=$(id -g)" --tag "my-image:latest" .
Sending build context to Docker daemon 3.072kB
Step 1/17 : FROM ubuntu:18.04
18.04: Pulling from library/ubuntu
no matching manifest for windows/amd64 10.0.17134 in the manifest list entries
The content of the Dockerfile is irrelevant. Docker could not pull the Ubuntu 18.04 image. Here is the full Dockerfile content anyway:
FROM ubuntu:18.04
RUN apt-get update && apt-get -y install gawk wget git-core \
diffstat unzip texinfo gcc-multilib build-essential \
chrpath socat cpio python python3 python3-pip \
python3-pexpect xz-utils debianutils iputils-ping \
libsdl1.2-dev xterm tar locales
RUN rm /bin/sh && ln -s bash /bin/sh
RUN locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV USER_NAME cuteradio
ENV PROJECT cuteradio
ARG host_uid=1001
ARG host_gid=1001
RUN groupadd -g $host_gid $USER_NAME && \
useradd -g $host_gid -m -s /bin/bash -u $host_uid $USER_NAME
USER $USER_NAME
ENV BUILD_INPUT_DIR /home/$USER_NAME/yocto/input
ENV BUILD_OUTPUT_DIR /home/$USER_NAME/yocto/output
RUN mkdir -p $BUILD_INPUT_DIR $BUILD_OUTPUT_DIR && \
cd $BUILD_INPUT_DIR && \
git clone --recurse-submodules https://github.com/bstubert/$PROJECT.git
ENV TEMPLATECONF=$BUILD_INPUT_DIR/$PROJECT/sources/meta-$PROJECT/custom
CMD ["source", "$BUILD_INPUT_DIR/$PROJECT/sources/poky/oe-init-build-env", \
"build", "&&", "bitbake", "$PROJECT-image"]
Linux Containers vs Windows Containers
Turns out the default setting for Docker Desktop for Windows is to use Windows container. Having re-installed my laptop from scratch and re-install Docker Desktop, I did not notice that Windows container is being used.The Docker documentation should be clear enough, otherwise refer to Microsoft's documentation on Windows containers.
In most cases, you should be using Linux Containers even on Windows.
Use Windows containers only when you need the functionalities that is otherwise not available on Linux containers. For example, building Windows Server containers, or running .NET Docker images that has dependencies to run on Windows Containers.
On the flip side:
- Most Docker images are built on Linux hosts, and upon Linux images
- Docker Linux images use features in Linux containers not available on Windows containers
- Some advanced networking and filesystem features only available on Linux containers
Switch to Linux Containers
When Docker Desktop is up and running, right-click on the Docker icon in the Notification Area, and click on "Switch to Linux containers..."You will see a warning Window. Click on Switch to proceed
After Docker Desktop has switched to Linux Container, try running your docker command again
λ docker build --no-cache --build-arg "host_uid=$(id -u)" --build-arg "host_gid=$(id -g)" --tag "my-image:latest" .
Sending build context to Docker daemon 3.072kB
Step 1/17 : FROM ubuntu:18.04
18.04: Pulling from library/ubuntu
423ae2b273f4: Pull complete
de83a2304fa1: Pull complete
f9a83bce3af0: Pull complete
b6b53be908de: Pull complete
Digest: sha256:04d48df82c938587820d7b6006f5071dbbffceb7ca01d2814f81857c631d44df
Status: Downloaded newer image for ubuntu:18.04
Your Linux-based Docker image should be able to run now on Docker Desktop for Windows.
No comments:
Post a Comment