I am trying to re-create the following diagram:

enter image description here Here is my code:


        node distance=0.1cm,
            outer sep=0pt,
            text centered,
            text width= 2cm,
        \node[mynode,fill=red] (line1a) {container};    
        \node[mynode,fill=red] (line1b) [right=of line1a] {container};
            \node[mynode,fill=red] (line1c) [right=of line1b] {container};
        \node[mynode,fill=purple] (line2a)[fit = (line1a)(line1c),
        below = 1cm of line1a.west,
        anchor= south west, inner sep=0, label=center:{container Runtime}] {};
        \node[mynode,fill=cyan] (line3a)[fit = (line2a),
        below = 1cm of line2a.west,
        anchor= south west, inner sep=0, label=center:{Container OS}] {};   
        \node[mynode,fill=gray] (line4a)[fit = (line3a),
        below = 1cm of line3a.west,
        anchor= south west, inner sep=0, label=center:{Physical Host (or VM)}] {};      

and my progress so far: enter image description here

I am still new to TikZ, Is there an easier way to draw it ?

  • Not really. A tikz matrix might help. You can use a scope with [local bounding box=name] to create a node like entity containing other nodes and things. Personally, I've always avoided using the fit library. Nov 18, 2017 at 23:18

1 Answer 1


like this?

enter image description here

correct text and colors i left to you ....

\documentclass[tikz, margin=3mm]{standalone}

    node distance=2mm and 3mm,
    box/.style args = {#1/#2}{%
        minimum width=#1, minimum height=6mm, align=center,
        font=\bfseries, text=white,
        draw, inner sep=2mm, outer sep=0mm}
% left containers (in vertical midddle of image)
\node (nLa) [box=20mm/red]                {container};
\node (nLb) [box=20mm/red,right=of nLa]   {container};
\node (nLc) [box=20mm/red,right=of nLb]   {container};
% right containers (in vertical midddle of image)
\node (nRa) [box=20mm/red,right=of nLc]   {container};
\node (nRb) [box=20mm/red,right=of nRa]   {container};
\node (nRc) [box=20mm/red,right=of nRb]   {container};
% nodes below (left and right column)
\path   let \p1 = ($(nLa.west) - (nLc.east)$),
            \n1 = {veclen(\y1,\x1)} in
        node (nL2)   [box=\n1/purple, below=of nLb] {container Runtime}
        node (nL3)   [box=\n1/cyan,   below=of nL2] {Container OS}
        node (nL4)   [box=\n1/cyan,   below=of nL3] {Physical Host (or VM)}
        node (nR2)   [box=\n1/purple, below=of nRb] {container Runtime}
        node (nR3)   [box=\n1/cyan,   below=of nR2] {Container OS}
        node (nR4)   [box=\n1/cyan,   below=of nR3] {Physical Host (or VM)};
% nodes on bottom and top
\path   let \p1 = ($(nLa.west) - (nRc.east)$),
            \n1 = {veclen(\y1,\x1)} in
        node (nB)   [box=\n1/purple,
                     below=of $(nL4.south)!0.5!(nR4.south)$]        {DevOps Tools}
        node (nT1)  [box=\n1/black,
                     above=8mm of $(nLc.north)!0.5!(nRa.north)$]    {Container Network}
        node (nT2)  [box=\n1/blue!40!black,above=of nT1]            {Container \dots}
        node (nT3)  [box=\n1/blue!80!black,above=of nT2]            {Container \dots}
        node (nT4)  [box=\n1/blue!50,above=of nT3]                  {Container \dots};            
% nodes on left and right
\path   let \p1 = ($(nT4.north west) - (nL4.south west)$),
            \n1 = {veclen(\y1,\x1)} in
        node (L1)   [box=\n1/purple!80!black,
                    left=of $(nT4.north west)!0.5!(nL4.south west)$,
                    anchor=south, rotate=90]                        {Configureation \dots}
        node (L2)   [box=\n1/olive,
                    left=of L1.north,
                    anchor=south, rotate=90]                        {Marketplace/Image Management}
        node (L2)   [box=\n1/gray,
                    right=of $(nT4.north east)!0.5!(nR4.south east)$,
                    anchor=north, rotate=90]                        {Security}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.