Docker mirror is too large

  docker, question

Please consult, the company has a docker mirror image, which should be changed to several versions, installed a lot of services, and finally packaged out 17G.
Is there any problem with using such a large mirror, and it is not very easy to migrate. Is there any way to optimize it? There is only one tar package for export now, and there is no original dockerfile. . .

Provide an idea-first generate the docker File in reverse according to the Docker image, and then take a look at the details.
There is such a librarydockerfile-from-imageCan do this, but the library has not been maintained, I fork a little changed somethingdockerfile-from-imagePush to cloud.docker.com, then you can execute the command:

docker pull fanjieqi/dockerfile-from-image:latest
 alias dfimage="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock fanjieqi/dockerfile-from-image:latest"
 
 dfimage <tag>/<image>:<version>

In this way, the mirrored Dockerfile can be completely displayed. However, the files and folders operated by the add and copy commands are all with hash, and you can only guess what files and folders are operated, similar to this:

FROM node:9-alpine
 WORKDIR /app
 COPY file:7668b48cb0ef6effedbfcabe6e44cb7c70922fc63cf9e1a8fe2a259173835186 in /app
 RUN npm install --production --registry=https://registry.npm.taobao.org
 RUN echo -e "https://mirrors.ustc.edu.cn/alpine/latest-stable/main\  nhttps://mirrors.ustc.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories && apk update && apk add ca-certificates bash git openssh wget &&   update-ca-certificates && rm -rf /var/lib/apt/lists/*
 COPY dir:1a399e39f0bccf78b41ba08e1876cbb222b21475a24c80341ff413b5a0b90b67 in /app

I hope I can help you.