When using the Dockerfile build image, it is sometimes found that the content sent to daemon is too large
sending build context to docker daemon 4.358 gbstep 0 : from xxx.xxx.com/centos:7 ---> 218081f3bcdcstep 1 : RUN mkdir -p /data/mysql/base ---> Using cache ---> ac4aa04a93a1Step 2 : RUN adduser mysql ---> Using cache ---> f30c90e0e589Step 3 : ADD base /data/mysql/base ---> 3666ada5715cremoving intermediate container d65c5abdfe5cstep 4 : entrypoint /data/mysql/base/entrypoint.sh ---> Running in 3be4e22baff7 ---> a73907b2fbd5removing intermediate container 3be4e22baff7successfully built A73907b2fbd5
REPOSITORY TAG IMAGE ID CREATED VIRTUAL sizemarriadb latest A73907b2fbd5 seconds AG o 530.9 MB
But our dokerfile is very simple, so where does this extra content come from?
Discover that Docker client will send all files in the Dockerfile sibling directory to Dockerdaemon by default
There are two ways to solve this problem:
1. Create the. dockerignore file, write the unwanted files inside, the file contains the directory will not be sent to the Docker daemon
2. Just find an empty directory only dockerfile.
Problem with sending build context to Docker daemon when resolving Docker build