On docker-compose build
Dockerfile truncated by amount of cyrillic symbols in it.
For example, if I got 7 cyrillic symbols in the Dockerfile last 7 symbols of the end of file become "cutted off".
Output of docker-compose version
docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.8.1
OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019
Output of docker version
Client:
Version: 19.03.5-ce
API version: 1.40
Go version: go1.13.4
Git commit: 633a0ea838
Built: Fri Nov 15 03:19:09 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 19.03.5-ce
API version: 1.40 (minimum version 1.12)
Go version: go1.13.4
Git commit: 633a0ea838
Built: Fri Nov 15 03:17:51 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.3.2.m
GitCommit: d50db0a42053864a270f648048f9a8b4f24eced3.m
runc:
Version: 1.0.0-rc9
GitCommit: d736ef14f0288d6993a1845745d6756cfc9ddd5a
docker-init:
Version: 0.18.0
GitCommit: fec3683
Output of docker-compose config
see in the "steps to reproduce"
Create context
(empty) directory, docker-compose.yml
and Dockerfile
version: '3.7'
services:
test-pass:
build:
context: .
dockerfile: Dockerfile
test-fail:
build:
context: context
# path relative to the context
dockerfile: ../Dockerfile
FROM alpine
# 褕褕褕 懈 褎褎褎
RUN touch test
Run docker-compose build test-fail
docker-compose build test-fail
Building test-fail
Step 1/2 : FROM alpine
---> cdf98d1859c1
Step 2/2 : RUN touc
---> Running in fc83cc1f2b69
/bin/sh: touc: not found
ERROR: Service 'test-fail' failed to build: The command '/bin/sh -c touc' returned a non-zero code: 127
The string h test\n
(7 symbols) was disappeared.
This problem doesn't appear if the Dockerfile is in the context folder (look at the test-pass service).
This problem doesn't appear by using docker build
.
Expected result is succesfully created image, like by using docker build
:
docker build -f Dockerfile context
Sending build context to Docker daemon 1.583kB
Step 1/2 : FROM alpine
---> cdf98d1859c1
Step 2/2 : RUN touch test
---> Using cache
---> bb6362bff392
Successfully built bb6362bff392
N/A
thanks for reporting this issue with clear reproduction sample and initial investigation on breaking conditions. I'll investigate this issue next week
As a workaround, you can enable native CLI builder by setting COMPOSE_DOCKER_CLI_BUILD=true
(I expect this to become default value in a future release)
issue (afaict) is caused by https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L107-L109
tar size is computed as len(contents)
== character counts, while the actual tar entry is set by contents.encode('utf-8')
, which will then be truncated as some characters will be encoded on N>1 bytes.