Questions tagged [docker-build]

The Docker CLI (Command Language Interpreter) command for building Docker images.

Official documentation for this command is available here:

https://docs.docker.com/engine/reference/commandline/build/

560 questions
8
votes
2 answers

Mounting Maven Repository to Docker

I am trying to build a Java application and make a package using docker. This builds needs a maven repository which I don't want to include in the image, since it's very large. I wanted to try using volumes and mount my local maven repository to the…
Zeinab Abbasimazar
  • 9,835
  • 23
  • 82
  • 131
7
votes
4 answers

I Can't build my docker file to create my docker image using Docker build

When I try to build my docker file, docker return the following error: [+] Building 0.0s (1/2) …
olivedevelop
  • 81
  • 1
  • 3
7
votes
1 answer

Activate conda env and run pip install requirements in the Dockfile

I can create my virtual environment dev1 successfully, but I can not activate it and switch into in during the Docker building. All I want is to switch the venv and install my dependencies in requirements.txt. My code: WORKDIR /APP ADD . /APP ARG…
Jet C.
  • 126
  • 8
7
votes
1 answer

Using variables across multi-stage docker build

I want to use variables across multi-stage docker builds. Similar to This question (unanswered at the time of writing.) My specific use case is to build my Go project in a builder stage and save the directory this is done in in a variable and use…
Amin Karbas
  • 562
  • 1
  • 7
  • 16
7
votes
0 answers

Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I am getting the error below while trying to build docker image. My operating system is CentOS 7 on a corporate setting. Sending build context to Docker daemon 1.22GB Step 1/20 : FROM centos Get https://registry-1.docker.io/v2/: net/http: request…
Ben
  • 137
  • 3
  • 12
7
votes
1 answer

Why can't I use the build arg again after FROM in a Dockerfile?

I'm using Docker 18.05.0~ce~3-0~ubuntu and I'd like to pass a build argument to the FROM as well as other lines in my Dockerfile. You would expect the below to work: ARG FROM_IMAGE=ubuntu:bionic FROM $FROM_IMAGE COPY sources_list/$FROM_IMAGE…
gertvdijk
  • 24,056
  • 6
  • 41
  • 67
7
votes
2 answers

How to build docker image with local package inside folder with main.go?

I'm trying docker build -t test_1 . , but have this err: package docker_test/mult: unrecognized import path "docker_test/mult" (import path does not begin with hostname) The command '/bin/sh -c go get -d -v ./...' returned a non-zero code: 1 My…
Mzia
  • 406
  • 2
  • 7
  • 21
7
votes
1 answer

Docker: How to use multistage images after build finishes

Scenario Multistage builds combine multiple Dockerfile sections into a single one Intermediary and final stages can copy files from the upper stages Final stage is suggested to have only the binaries needed. With those in mind, I'd like to build…
Marcello DeSales
  • 21,361
  • 14
  • 77
  • 80
7
votes
1 answer

Create docker image running old Windows version

I am new to docker and my task is to create docker container running Windows 98. The difficult part is not having Windows 98 installed. My computer has Windows 7/Kubuntu 16 (dual boot). I am looking for some way of getting ready Windows98 docker…
sunny
  • 1,887
  • 3
  • 29
  • 40
7
votes
2 answers

mkdir is not executing in Dockerfile/build

There is already a question, with answer, under a similar title, but the title isn't really outlining the true question. mkdir is in fact executing for the other question/thread. It is just failing... Whereas I've: RUN mkdir -p /home/developer And I…
6
votes
2 answers

How to disable loading metadata while executing Docker build?

Windows 10, DockerDesktop v3.5.2, Docker v20.10.7 Whenever my computer is disconnected from the Internet the command docker build -t my_image . produces output like the following. Dockerfile contains line FROM some_public_image:123 => [internal]…
diziaq
  • 6,881
  • 16
  • 54
  • 96
6
votes
1 answer

Dockerfile COPY vs "docker run ... cp"

We have a build pipeline that first does a docker build using a dockerfile. That dockerfile has a number of COPY commands. We also have a later step that does a docker run, with 'cp' command, as follows: docker run --volume /hostDirA:/containerDirB…
GaTechThomas
  • 5,421
  • 5
  • 43
  • 69
6
votes
1 answer

How to run different ENTRYPOINT commands in docker-compose.yml for different build environments?

Right now I have a single docker-compose.yml: version: "3" services: hello-world: image: hello-world build: . environment: NODE_ENV: development ports: - 3000:3000 entrypoint: npm run dev # entrypoint: npm…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
6
votes
2 answers

"docker build" requires exactly 1 argument

I just want to build a dockerfile from a different directory, I tried the following command docker build -f C:/Users/XXXX/XXXX/XXXX/XXXX/XXXX/Dockerfile and docker build -f C://Users/XXXX/XXXX/XXXX/XXXX/XXXX/Dockerfile Both of them yield the same…
Ajay Sabarish
  • 171
  • 2
  • 6
6
votes
0 answers

Missing /v8 variant from linux/arm64 platform

I'm using buildx for my multiarch Docker build. The base image python:3.8.5-alpine has linux/arm64/v8 as one of its OS/archs, but the resulting image (corralpeltzer/newtrackon) has the variant /v8 missing, creating an image with linux/arm64 in its…