Why is the pushed image so big?

I’m going through the getting-started tutorial. When I
docker push myusername/getting-started
I see 200+ MM is sent, and then the hub shows
COMPRESSED SIZE
137.73 MB

The “app” folder on my desktop is only 4.5 MB. Why is the pushed image so much larger?

Hi

can you provide which tutorial you’re following?
also if you’re using a dockerfile provide that?

because, lets say that you’re using an apache og php image, thats the first 150mb there, and then you add your data to it afterwards

Tutorial started here
https://docs.docker.com/get-started/

Here’s where the created image gets pushed to hub
https://docs.docker.com/get-started/04_sharing_app/

Ah okay

FROM node:12-alpine
RUN apk add --no-cache python2 g++ make
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]

each line in this, creates a layer of a docker image, so its starts by downloading node:12-alpine, which is 50mb
then it downloads python and a compiler (no idea how much that is, lets just say +50mb), now totals: 100mb
then it copies the local app folder to the app folder in the container, thats +4.5mb (now: 104,5mb)
then it installs the dependencies of your project (yarn install), lets say that +30mb, now totals 134,5mb

so its because it all adds up. :slight_smile: