I have followed these steps and when I run PS C:\dockeragent> docker build -t dockeragent:latest .
I get
[+] Building 0.8s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019 0.7s
------
> [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:etcetc: not found
I am using VSC with Docker extention on my local computer. How can I build this image?
From the log, the image is build from a windows image(windows/servercore:ltsc2019).
You need to check if the docker desktop on your local machine is running on Windows containers.
If no, you need to switch it to Windows containers.
Related
I have a MacBook Pro with M1 and I am trying to test if I can build an ARM64 image with a base image that only supports AMD64 by specifying --platform linux/arm64.
I tested with rocker/r-ver:4.0.4(only supports AMD64) and was able to build with this command below without any error
docker build --platform linux/arm64 -t r-ver-arm64:test
my dockerfile is just FROM rocker/r-ver:4.0.4
But when I tested with python:3.3-alpine3.4(supports AMD64 only) with command
docker build --platform linux/arm64 -t python-arm64:test
Dockerfile is FROM python:3.3-alpine3.4
I've got an error message, saying no match for platform in manifest
[+] Building 1.3s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 207B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> ERROR [internal] load metadata for docker.io/library/python:3.3-alpine3.4 1.2s
=> [auth] library/python:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/python:3.3-alpine3.4:
------
error: failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:32b65b0dd11df5fb4dcf1e0f6bb05007b6b84270959ab27b618b513321ef6d6a: not found
I don't understand why it works for r-ver:4.0.4 base image, but doesn't for python:3.3-alpine3.4
Could someone help me with it?
Windows 10 Version: 10.0.18362.1256
Docker Desktop Version: 3.6.0(the latest until 2021/8/25)
Dockerfile from https://github.com/docker/getting-started.
Command: docker build -t getting-started .
Logs:
niaomingjian#DESKTOP-DQO:~/docker/getting-started$ docker build -t getting-started .
[+] Building 0.2s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.05kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 52B 0.0s
=> CANCELED [internal] load metadata for docker.io/library/nginx:alpine 0.1s
=> CANCELED [internal] load metadata for docker.io/library/python:alpine 0.1s
=> ERROR [internal] load metadata for docker.io/library/node:12-alpine 0.1s
------
> [internal] load metadata for docker.io/library/node:12-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests 12-alpine]: 403 Forbidden
Command docker pull node:12-alpine succeeded.
Pulling nginx:alpine, python:alpine, node:12-alpine respectively can work.
But the pulling process could't work in the building process.
Based Jeff Gruenbaum's comment:
Are you using gcr? 403 Forbidden means you don't have permission to pull.
Try (You must using gcloud if pull from gcr, right?):
gcloud config configurations list then you see list of your gcp account
switch your account to account that have pull permission by gcloud config configurations activate YOUR_ACCOUNT.
Relatively new to Docker and Compose, but I have read every letter of the Docker Compose documentation, and unsuccessfully bounced around SO for hours, with no resolution to the above question.
I have an (example) directory with the following files:
./Dockerfile:
# syntax=docker/dockerfile:1
ARG CUSTOM_NODE_VERSION
FROM node:$CUSTOM_NODE_VERSION
ARG CUSTOM_NODE_VERSION
ARG HELLO
RUN echo "HELLO: -> $HELLO"
RUN echo "NODE_VERSION -> $NODE_VERSION"
RUN echo "CUSTOM_NODE_VERSION -> $CUSTOM_NODE_VERSION"
./docker-compose.yml:
version: "3.8"
services:
test:
build:
context: .
dockerfile: Dockerfile
args:
CUSTOM_NODE_VERSION: alpine
HELLO: 5
What I want is for docker compose build to use the args specified in the docker-compose.yml file, but it doesn't:
> docker compose build test
[+] Building 0.8s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 0.5s
=> CACHED docker-image://docker.io/docker/dockerfile:1#sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2 0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to create LLB definition: failed to parse stage name "node:": invalid reference format
But run works fine:
docker compose run test
[+] Running 1/1
⠿ Network compose-args_default Created 4.3s
[+] Building 3.1s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 0.5s
=> CACHED docker-image://docker.io/docker/dockerfile:1#sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2 0.0s
=> [internal] load metadata for docker.io/library/node:alpine 1.0s
=> CACHED [1/4] FROM docker.io/library/node:alpine#sha256:f372a9ffcec27159dc9623bad29997a1b61eafbb145dbf4f7a64568b 0.0s
=> [2/4] RUN echo "HELLO: -> 5" 0.5s
=> [3/4] RUN echo "NODE_VERSION -> 16.3.0" 0.3s
=> [4/4] RUN echo "CUSTOM_NODE_VERSION -> alpine" 0.5s
=> exporting to image 0.1s
=> => exporting layers 0.0s
=> => writing image sha256:e61653277599e3555b67c1a50699dd83d5c1ed1a93fe8a1a16529c6ec20e3e31 0.0s
=> => naming to docker.io/library/compose-args_test
This is all the more baffling to me because, per the Compose docs:
args
Add build arguments, which are environment variables accessible only during the build process.
Any help is much appreciated 🙏🏻
Build args were only recently added to compose-cli. Most likely that change hasn't reached the version of docker compose you're running. You can use docker-compose build (with a -) until this feature reaches your install.
I am new to Docker.
I cloned the GitHub project and trying to create the image by running:
docker build -t imagename .
But its giving an error:
username#LAPTOP-MMMMBU:~/myfolder/test$ docker build -t newimage .
[+] Building 10.8s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for registry.abcd.org/test:base 10.8s
------
> [internal] load metadata for registry.abcd.org/test:base:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests base]: 401 Unauthorized
Where to insert the credentials here (user/password).
Please help.
If you are asking how you can authenticate to the docker registry where you are pulling your base image, you can run docker login registry.abcd.org, and enter your username and password when prompted. Your subsequent build command will then be able to pull the image.
docker login [OPTIONS] [SERVER]
https://docs.docker.com/engine/reference/commandline/login/
I'm trying to build an image from CentOS 6.9. Using this Dockerfile:
FROM centos:6.9
RUN ls
But it keeps failing with exit code 139 with the following output:
$ docker build -t centos-6.9 .
[+] Building 1.1s (7/7) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 72B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/centos:6.9 0.6s
=> [internal] load build context 0.1s
=> => transferring context: 72B 0.0s
=> CACHED [1/3] FROM docker.io/library/centos:6.9#sha256:6fff0a9edc920968351eb357c5b84016000fec6956e6d745f695e5a34f18ecd2 0.0s
=> [2/3] COPY . . 0.0s
=> ERROR [3/3] RUN ls 0.3s
------
> [3/3] RUN ls:
------
executor failed running [/bin/sh -c ls]: exit code: 139
I'm running:
Windows 10 Enterprise Version 2004
Docker Desktop 3.0.0
This appears to be an issue with WSL 2 with older base images, not docker or the image itself.
Create %userprofile%\.wslconfig file.
Add the following:
[wsl2]
kernelCommandLine = vsyscall=emulate
Restart WSL. wsl --shutdown
Restart Docker Desktop.
References:
https://github.com/microsoft/WSL/issues/4694#issuecomment-556095344
https://github.com/docker/for-win/issues/7284#issuecomment-646910923
https://github.com/microsoft/WSL/issues/4694#issuecomment-558335829