8000 Docker overlay native diff disabled resulting image build failure · Issue #403 · flatcar/Flatcar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Docker overlay native diff disabled resulting image build failure #403
Closed
@hligit

Description

@hligit

Description

Docker storage native overlay diff is disabled by default

Impact

Some Docker image build failed for error layer doesn't exist.

Environment and steps to reproduce

  1. Set-up:

Launch an EC2 instance from Flatcar-stable-2765.2.5.

  1. Task:

Build a Docker image with below Dockerfile:

# echo hello > 1
# cat <<EOF > Dockerfile
FROM scratch AS base
COPY 1 /1
FROM base
# "useless" copy works ...
COPY --from=base /1 /1
# ... and the COPY statement after it fails
COPY 1 /2
EOF

# docker build -t mytest .
Sending build context to Docker daemon  3.072kB
Step 1/5 : FROM scratch AS base
 --->
Step 2/5 : COPY 1 /1
 ---> 6fe1b1fd9cab
Step 3/5 : FROM base
 ---> 6fe1b1fd9cab
Step 4/5 : COPY --from=base /1 /1
 ---> 12bd28054ffd
Step 5/5 : COPY 1 /2
failed to export image: failed to create image: failed to get layer sha256:ec22588dcfceca289a1df0a426789512fd73560b296eb6a64b60b14b316be019: layer does not exist

Notice overlay module features redirect_dir and metacopy are enabled and docker reports native overlay diff is disabled.

# cat /sys/module/overlay/parameters/redirect_dir
Y
# cat /sys/module/overlay/parameters/metacopy
Y
# docker info
......
Server:
......
 Server Version: 19.03.15
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false

Expected behavior

Expect the Docker image be built successfully

Additional information

The same Docker image can be built without issue by turning off overlay module features redirect_dir and metacopy.

# echo N > /sys/module/overlay/parameters/redirect_dir
# echo N > /sys/module/overlay/parameters/metacopy
# systemctl restart docker
# docker build -t mytest .
Sending build context to Docker daemon  3.072kB
Step 1/5 : FROM scratch AS base
 --->
Step 2/5 : COPY 1 /1
 ---> Using cache
 ---> 6fe1b1fd9cab
Step 3/5 : FROM base
 ---> 6fe1b1fd9cab
Step 4/5 : COPY --from=base /1 /1
 ---> Using cache
 ---> 12bd28054ffd
Step 5/5 : COPY 1 /2
 ---> bf943f2dd295
Successfully built bf943f2dd295
Successfully tagged mytest:latest

Notice now Docker reports that native overlay diff is enabled

# docker info
......
Server:
......
 Server Version: 19.03.15
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
......

Please add any information here that does not fit the above format.

The change that enabled the two overlay features is flatcar-archive/coreos-overlay#691. Related issue #170

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Implemented

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0