Update Docker Forked Image from Master

Hey. I’m pretty new to a lot of this.

If I fork an image and push it to my own repository and then add some of my own stuff to it, can I then pull changes from the repo that I originally got it from?

For example, Let’s say I’ve pulled an image from centurylink/WordPress. I then install php-apc and upload that php-apc+Wordpress image to my public repo: thejoeyo/WordPress. Can I still pull changes as the original centurylink/WorPpress image gets updated? If so, will it wipe out php-apc?

Thanks in advance!

Hi,

You will get to know this better if you just trace the history of the docker images from their respective Dockerfile.

Lets start from your modified Docker Image. Your Dockerfile might have started as shown below.

# Your thejoeyo/WordPress Dockerfile
FROM centurylink/WordPress

The centurylink/WordPress started like this.

# centurylink/Wordpress Dockerfile
FROM centurylink/apache-php:latest

The centurylink/apache-php:latest started like this

#centurylink/apache-php:latest Dockerfile
FROM ubuntu:trusty

So the ubuntu:trusty is the baseimage where from the whole journey of your image started from.

ubuntu:trusty   centurylink/apache-php:latest  centurylink/Wordpress  thejoeyo/Wordpress
    A                       A                          A                      A
    B                       B                          B                      B
                            C                          C                      C
                                                       D                      D
                                                                              E

Above you can see the relation between each image. Each new image inherits the parent images layers. And in your case the difference from the parent image and your image is the layer E.

Now imagine any of the parent image gets updated, then once you rebuild the child image you will inherit the changes happened to the parent image as shown below. And your changes will now get a new Layer ID say F.

ubuntu:trusty   centurylink/apache-php:latest  centurylink/Wordpress  thejoeyo/Wordpress
    A                       A                          A                      A
    B                       B                          B                      B
                            C                          C                      C
                                                       D                      D
                                       New Layer  >>   X                      X
                                                                              F

I wonder whether my explanation has gone wild :wink:. Hope this makes sense :slight_smile:

I request you to make use of the docker history command to get a better view of each image you are dealing with. There you can see the actual layer ID’s getting inherited.

Regards

1 Like