need help to understand docker source code

783 views
Skip to first unread message

mathewkoshy493

unread,
Sep 8, 2015, 2:04:36 AM9/8/15
to docker-dev
hi friends,
     I want to do some experimentation with docker, I was trying to manually read docker source code in order to understand what portion of source code is doing what, I was not able to get any help from internet sources in understanding the source code,If there is any blog or any website or any other source from which I can learn the source code please give me the link for the same so that I can save a lot of time in the process of understanding the code

Ian Miell

unread,
Sep 8, 2015, 2:20:58 AM9/8/15
to mathewkoshy493, docker-dev
There are not a great deal of comments, but the code is relatively lucid, concise and well-structured.

My advice would be:

- learn go
- figure out how the basic command flags work
- build docker executables with minor changes

This should get you familiar enough to start looking at more ambitious things.

On Tue, Sep 8, 2015 at 7:04 AM, mathewkoshy493 <mathewk...@gmail.com> wrote:
hi friends,
     I want to do some experimentation with docker, I was trying to manually read docker source code in order to understand what portion of source code is doing what, I was not able to get any help from internet sources in understanding the source code,If there is any blog or any website or any other source from which I can learn the source code please give me the link for the same so that I can save a lot of time in the process of understanding the code

--
You received this message because you are subscribed to the Google Groups "docker-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to docker-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Currently co-authoring a book on Docker: Get 39% off with the code 39miell

mathewkoshy493

unread,
Sep 8, 2015, 2:29:56 AM9/8/15
to docker-dev
@ Ian thnx 

Arif A.

unread,
Feb 8, 2017, 8:27:08 AM2/8/17
to docker-dev
Hi Mathewkoshy,

  I am Arif. I am also trying to understand the source code of docker, and hopefully, I want to change some of the things to increase the performance of docker. This thread looks like very old, and I don't know whether you are active or now at this moment. In any way, If you have found anything that will ease my understanding of docker source code, please help me.

- Arif

Jérôme Petazzoni

unread,
Feb 11, 2017, 9:30:04 AM2/11/17
to Arif A., docker-dev
Hi Arif,

To help new contributors to get started, the maintainers have tagged a bunch of GitHub issues according to their difficulty level.
For instance, the following link will show you a list of features and bug fixes that should be relatively easy to start with:

I also recommend to check the "Contributing to Docker" guide, which contains lots of great information and tips:

Thank you for your help!


--
You received this message because you are subscribed to the Google Groups "docker-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to docker-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Stephen Day

unread,
Feb 13, 2017, 4:50:14 PM2/13/17
to Jérôme Petazzoni, Arif A., docker-dev
Arif:

In general, the best way to approach the docker code base is to trace a command from end to end. I usually will start with the cli command[1], then trace that through to the http endpoint to see how the command is handled. You can see an example of the container routes[2], but different subsystems register their routes individual. From there, I usually use code search to identify a specific backend implementations that match up to the actual http handlers. For the most part, the behavior of the daemon can be traced from the handlers into the daemon package[3]. Depending on what you are trying to understand, working from there might be enough, but be careful about making assumptions about how things work.

The first time doing this can be daunting, as it is more than a few indirects of calls and interfaces. Adding print statements along various call paths and rebuilding the daemon and cli is a great exercise in building understanding of how the daemon works. Once you use this practice enough, you'll build an intuition that will be more than enough to get around.

 I want to change some of the things to increase the performance of docker.

This is a worthy cause but most of the "easy" stuff is already taken care of. I am not saying there are no optimizations left in docker. I am saying that you'll have to make hard trade offs to bring optimizations to docker. It is very easy to push a change that looks like an optimization but can actually make things slower for a certain class of users (I am more than guilty of this). That said, there may be areas to reduce lock contention that I am unaware of.

When building out optimizations for docker, the key is first find something that can be benchmarked and then optimized in the broad case. Make sure the benchmarks take into account the full domain of input, as well as machine type and size. Also, make sure that the cost of the optimization is appropriately balanced against complexity. For example, an optimization that breaks a guarantee or expands an interface awkwardly may not be considered because the maintenance to keep the optimization may be too costly.

In the near term, I think the bulk of optimization work lies in effective measurement. For 1.13, we added experimental support for export of prometheus metrics. New metrics can be added with go-metrics[4]. Measuring more stuff in docker internals will help greatly in identifying areas that need larger work to optimize.

I hope this helps.

Stephen.



To unsubscribe from this group and stop receiving emails from it, send an email to docker-dev+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "docker-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to docker-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages