{"id":9544,"date":"2016-12-12T19:30:41","date_gmt":"2016-12-12T18:30:41","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/"},"modified":"2016-12-12T19:30:41","modified_gmt":"2016-12-12T18:30:41","slug":"getting-started-with-docker-2-building-your-own-base-image","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/","title":{"rendered":"Getting started with Docker \u2013 2 \u2013 building your own base image"},"content":{"rendered":"<p>In the <a href=\"http:\/\/dbi-services.com\/blog\/getting-started-with-docker-1-overview-and-installation\/\" target=\"_blank\" rel=\"noopener\">last post<\/a> we quickly looked at how you can install everything you need to run docker containers on a CentOS 7 host and did bring up the official PostgreSQL image. However there are good reasons not to rely on an existing image: You want to deliver a pre-configured base image which includes everything your application requires and you want to have control over that image. When this image needs to get updated you can update the base image and then re-deploy it to wherever you need to update the base image.<\/p>\n<p><!--more--><\/p>\n<p>For CentOS there is <a href=\"https:\/\/github.com\/docker\/docker\/blob\/master\/contrib\/mkimage-yum.sh\" target=\"_blank\" rel=\"noopener\">a script which you can use to build your base image on GitHub<\/a>. For other distributions you can check the <a href=\"https:\/\/docs.docker.com\/engine\/userguide\/eng-image\/baseimages\/\" target=\"_blank\" rel=\"noopener\">docker documentation<\/a>. This script basically makes use of the <a href=\"http:\/\/www.linuxcommand.org\/man_pages\/yum8.html\" target=\"_blank\" rel=\"noopener\">&#8220;&#8211;installroot&#8221;<\/a> switch of yum which allows to install packages to another location than the default one.<\/p>\n<p>Using this script we can build a CentOS 7 base image. There are three parameters you can use:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n  -p \"\"  The list of packages to install in the container.\n                   The default is blank.\n  -g \"\"    The groups of packages to install in the container.\n                   The default is \"Core\".\n  -y      The path to the yum config to install packages from. The\n                   default is \/etc\/yum.conf for Centos\/RHEL and \/etc\/dnf\/dnf.conf for Fedora\n<\/pre>\n<p>We&#8217;ll use the &#8220;-p&#8221; switch to install all the packages which are required to build PostgreSQL from source (this depends on the compile options, of course) and some additional packages which are useful for daily work (such as screen):<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 ~]$ sudo .\/mkimage-yum.sh -p \"gcc openldap-devel python-devel readline-devel redhat-lsb bison flex perl-ExtUtils-Embed zlib-devel crypto-utils openssl-devel pam-devel libxml2-devel libxslt-devel tcl tcl-devel openssh-clients bzip2 net-tools wget screen ksh unzip\" centospg\n<\/pre>\n<p>Once done the new image is available locally:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 ~]$ docker images\nREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\ncentospg            7.2.1511            184509483d52        40 seconds ago      510.6 MB\npostgres            latest              78e3985acac0        2 days ago          264.7 MB\nhello-world         latest              c54a2cc56cbb        5 months ago        1.848 kB\n<\/pre>\n<p>If you wonder how that image made it into docker take a look a the last lines of the script:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\ntar --numeric-owner -c -C \"$target\" . | docker import - $name:$version\n<\/pre>\n<p>What happened is that a tar file of the temporary <a href=\"https:\/\/en.wikipedia.org\/wiki\/Chroot\" target=\"_blank\" rel=\"noopener\">chroot directory<\/a> was created:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 ~]$ ls -latr \/tmp\/mkimage-yum.sh.dKHtsq\/\ntotal 24\ndrwxrwxrwt.  2 root root    6 Aug 12  2015 tmp\ndr-xr-xr-x.  2 root root    6 Aug 12  2015 sys\ndrwxr-xr-x.  2 root root    6 Aug 12  2015 srv\ndrwxr-xr-x.  2 root root    6 Aug 12  2015 run\ndr-xr-x---.  2 root root    6 Aug 12  2015 root\ndr-xr-xr-x.  2 root root    6 Aug 12  2015 proc\ndrwxr-xr-x.  2 root root    6 Aug 12  2015 opt\ndrwxr-xr-x.  2 root root    6 Aug 12  2015 mnt\ndrwxr-xr-x.  2 root root    6 Aug 12  2015 media\ndrwxr-xr-x.  2 root root    6 Aug 12  2015 home\ndrwxr-xr-x.  2 root root 4096 Aug 12  2015 dev\ndr-xr-xr-x.  2 root root    6 Aug 12  2015 boot\nlrwxrwxrwx.  1 root root    7 Dec 10 15:02 bin -&gt; usr\/bin\nlrwxrwxrwx.  1 root root    8 Dec 10 15:02 sbin -&gt; usr\/sbin\nlrwxrwxrwx.  1 root root    9 Dec 10 15:02 lib64 -&gt; usr\/lib64\nlrwxrwxrwx.  1 root root    7 Dec 10 15:02 lib -&gt; usr\/lib\ndr-xr-xr-x. 17 root root 4096 Dec 10 15:02 .\ndrwxr-xr-x. 13 root root 4096 Dec 10 15:02 usr\ndrwxr-xr-x. 17 root root 4096 Dec 10 15:02 var\ndrwxr-xr-x. 19 root root 4096 Dec 10 15:02 etc\ndrwxrwxrwt. 11 root root 4096 Dec 12 11:43 ..\n<\/pre>\n<p>&#8230; which then was imported into docker with the &#8220;docker import&#8221; command.<\/p>\n<p>To test if it really works we can start it and execute bash:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 ~]$ docker run -it --rm  centospg:7.2.1511 bash\n[root@cf690e9d9476 \/]$ cat \/etc\/os-release \nNAME=\"CentOS Linux\"\nVERSION=\"7 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:\/o:centos:centos:7\"\nHOME_URL=\"https:\/\/www.centos.org\/\"\nBUG_REPORT_URL=\"https:\/\/bugs.centos.org\/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n<\/pre>\n<p>Fine, so far so good. Now we can really begin: We have our own CentOS base image where we want our PostgreSQL image to be based on. How then can we create a PostgreSQL image on top of our base image? <\/p>\n<p>We&#8217;ll execute the commands necessary first and provide explanations afterwards. So, the first step:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 ~]$ sudo yum install -y git\n[docker@centos7 ~]$ mkdir centospg\n[docker@centos7 ~]$ cd centospg\n[docker@centos7 centospg]$ git init\nInitialized empty Git repository in \/home\/docker\/centospglatest\/.git\/\n[docker@centos7 centospg]$ git config --global user.email \"daniel@abc.def\"\n[docker@centos7 centospg]$ git config --global user.name \"Daniel\"\n<\/pre>\n<p>Why do we need git? It is not required to use git at all but you probably would like to have your files which are used to build your containers managed by git so that you can use all advantages of GIT combined with the advantages of docker. It will will make more and more sense as we step through all the commands.<\/p>\n<p>What we need to create now is a so called <a href=\"https:\/\/docs.docker.com\/engine\/reference\/builder\/\" target=\"_blank\" rel=\"noopener\">Dockerfile<\/a>. This file lists the instructions that Docker will execute to build you image. Lets go:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 centospg]$ touch Dockerfile\n[docker@centos7 centospg]$ git add Dockerfile \n[docker@centos7 centospg]$ git commit -m \"initial\" Dockerfile \n[master (root-commit) ce3727a] initial\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 Dockerfile\n<\/pre>\n<p>Our very basic Dockerfile will look like this:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n# use our CentOS base images as source\nFROM centospg:7.2.1511\n# set the PostgreSQL we will download\nENV PG_VERSION 9.6.1\n# include the PostgreSQL binaries in the PATH\nENV PATH \/u01\/app\/postgres\/product\/96\/db_01\/bin:$PATH\n# add a postgres group and postgres user\nRUN groupadd postgres\nRUN useradd -g postgres -m postgres\n# prepare the directories\nRUN mkdir -p \/u01\/app\/postgres\nRUN chown postgres:postgres \/u01\/app\/postgres\n# allow sudo for the postgres user\nRUN echo 'postgres ALL=(ALL) NOPASSWD:ALL' &gt;&gt; \/etc\/sudoers\n# download, configure, compile and install PostgreSQL from source\nUSER postgres\nRUN wget https:\/\/ftp.postgresql.org\/pub\/source\/v${PG_VERSION}\/postgresql-${PG_VERSION}.tar.bz2 -O \/var\/tmp\/postgresql-${PG_VERSION}.tar.bz2\nRUN cd \/var\/tmp; tar -axf \/var\/tmp\/postgresql-${PG_VERSION}.tar.bz2\nRUN rm -f \/var\/tmp\/postgresql-${PG_VERSION}.tar.bz2\nRUN cd \/var\/tmp\/postgres*; .\/configure --prefix=\/u01\/app\/postgres\/product\/96\/db_01\nRUN cd \/var\/tmp\/postgres*; make\nRUN cd \/var\/tmp\/postgres*; make install\n# cleanup\nRUN rm -rf \/var\/tmp\/postgres*\n<\/pre>\n<p>Using this Dockerfile we can build our PostgreSQL image:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 centospg]$ docker build -t centospg:PG9.6.1 .\n<\/pre>\n<p>The output of this is quite long, here a snippet:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nSending build context to Docker daemon 45.06 kB\nStep 1 : FROM centospg:7.2.1511\n ---&gt; 184509483d52\nStep 2 : ENV PG_VERSION 9.6.1\n ---&gt; Running in 054900c7ebe1\n ---&gt; 866815b9f092\nRemoving intermediate container 054900c7ebe1\nStep 3 : ENV PATH \/u01\/app\/postgres\/product\/96\/db_01\/bin:$PATH\n ---&gt; Running in 46bcf7667a06\n ---&gt; 94c9adb0402b\nRemoving intermediate container 46bcf7667a06\nStep 4 : RUN groupadd postgres\n ---&gt; Running in 24a7d9b7a1ea\n ---&gt; eb4ff8268e2e\nRemoving intermediate container 24a7d9b7a1ea\nStep 5 : RUN useradd -g postgres -m postgres\n ---&gt; Running in 3e09b556fed8\n ---&gt; acff1dcf2d4c\nRemoving intermediate container 3e09b556fed8\nStep 6 : RUN mkdir -p \/u01\/app\/postgres\n ---&gt; Running in 999a62d075c0\n ---&gt; fa4bdfa74d31\nRemoving intermediate container 999a62d075c0\nStep 7 : RUN chown postgres:postgres \/u01\/app\/postgres\n ---&gt; Running in 37773e484260\n ---&gt; 668c491b534b\nRemoving intermediate container 37773e484260\nStep 8 : RUN echo 'postgres ALL=(ALL) NOPASSWD:ALL' &gt;&gt; \/etc\/sudoers\n ---&gt; Running in bb9cbfd20623\n ---&gt; 589959efbda5\nRemoving intermediate container bb9cbfd20623\nStep 9 : USER postgres\n ---&gt; Running in f70b8c70c3fc\n ---&gt; 32d3d3d603d2\nRemoving intermediate container f70b8c70c3fc\nStep 10 : RUN wget https:\/\/ftp.postgresql.org\/pub\/source\/v${PG_VERSION}\/postgresql-${PG_VERSION}.tar.bz2 -O \/var\/tmp\/postgresql-${PG_VERSION}.tar.bz2\n ---&gt; Running in c5cc11840a15\n--2016-12-12 12:43:05--  https:\/\/ftp.postgresql.org\/pub\/source\/v9.6.1\/postgresql-9.6.1.tar.bz2\nResolving ftp.postgresql.org (ftp.postgresql.org)... 174.143.35.246, 217.196.149.55, 87.238.57.227, ...\nConnecting to ftp.postgresql.org (ftp.postgresql.org)|174.143.35.246|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 19260568 (18M) [application\/x-bzip]\nSaving to: '\/var\/tmp\/postgresql-9.6.1.tar.bz2'\n\n     0K .......... .......... .......... .......... ..........  0%  180K 1m44s\n    50K .......... .......... .......... .......... ..........  0%  368K 77s\n...\n ---&gt; 645cf59717f4\nRemoving intermediate container c5cc11840a15\nStep 11 : RUN cd \/var\/tmp; tar -axf \/var\/tmp\/postgresql-${PG_VERSION}.tar.bz2\n ---&gt; Running in 6a47968ddeb5\n...\n# PostgreSQL configure, make, make install\n...\nPostgreSQL installation complete.\n ---&gt; 7f6b11b357d7\nRemoving intermediate container 041441816c4d\nStep 16 : RUN rm -rf \/var\/tmp\/postgres*\n ---&gt; Running in 480cc2157b9a\n ---&gt; a7b0bf1d1c35\nRemoving intermediate container 480cc2157b9a\nSuccessfully built a7b0bf1d1c35\n<\/pre>\n<p>Once all of that completed we have a new Docker image:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 centospg]$ docker images\nREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\ncentospg            PG9.6.1             a7b0bf1d1c35        45 seconds ago      706.7 MB\ncentospg            7.2.1511            184509483d52        47 hours ago        510.6 MB\npostgres            latest              78e3985acac0        4 days ago          264.7 MB\nhello-world         latest              c54a2cc56cbb        5 months ago        1.848 kB\n<\/pre>\n<p>Using this image we can now bring up a container which complies to all our standards we build into the base images:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 centospg]$ docker run -it centospg:PG9.6.1 bash\n[postgres@7ac7780b0b1b \/]$ which initdb\n\/u01\/app\/postgres\/product\/96\/db_01\/bin\/initdb\n[postgres@7ac7780b0b1b \/]$ initdb --version\ninitdb (PostgreSQL) 9.6.1\n<\/pre>\n<p>Finally we commit our Dockerfile:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[docker@centos7 centospg]$ git commit -m \"First working version\" Dockerfile \n[master f0ba897] First working version\n 1 file changed, 25 insertions(+)\n<\/pre>\n<p>Something to start with, isn&#8217;t it?<\/p>\n<p>Note: The Docker best practices tell you to add only few instructions to a Dockerfile because every instruction creates a new layer. In general you should run only one service per image. This makes it easier to scale you containers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last post we quickly looked at how you can install everything you need to run docker containers on a CentOS 7 host and did bring up the official PostgreSQL image. However there are good reasons not to rely on an existing image: You want to deliver a pre-configured base image which includes everything [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[601,77],"type_dbi":[],"class_list":["post-9544","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-docker","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Getting started with Docker \u2013 2 \u2013 building your own base image - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting started with Docker \u2013 2 \u2013 building your own base image\" \/>\n<meta property=\"og:description\" content=\"In the last post we quickly looked at how you can install everything you need to run docker containers on a CentOS 7 host and did bring up the official PostgreSQL image. However there are good reasons not to rely on an existing image: You want to deliver a pre-configured base image which includes everything [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-12T18:30:41+00:00\" \/>\n<meta name=\"author\" content=\"Daniel Westermann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@westermanndanie\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Westermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\"},\"author\":{\"name\":\"Daniel Westermann\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"headline\":\"Getting started with Docker \u2013 2 \u2013 building your own base image\",\"datePublished\":\"2016-12-12T18:30:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\"},\"wordCount\":530,\"commentCount\":0,\"keywords\":[\"Docker\",\"PostgreSQL\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\",\"name\":\"Getting started with Docker \u2013 2 \u2013 building your own base image - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2016-12-12T18:30:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting started with Docker \u2013 2 \u2013 building your own base image\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66\",\"name\":\"Daniel Westermann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"caption\":\"Daniel Westermann\"},\"description\":\"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.\",\"sameAs\":[\"https:\/\/x.com\/westermanndanie\"],\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Getting started with Docker \u2013 2 \u2013 building your own base image - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/","og_locale":"en_US","og_type":"article","og_title":"Getting started with Docker \u2013 2 \u2013 building your own base image","og_description":"In the last post we quickly looked at how you can install everything you need to run docker containers on a CentOS 7 host and did bring up the official PostgreSQL image. However there are good reasons not to rely on an existing image: You want to deliver a pre-configured base image which includes everything [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/","og_site_name":"dbi Blog","article_published_time":"2016-12-12T18:30:41+00:00","author":"Daniel Westermann","twitter_card":"summary_large_image","twitter_creator":"@westermanndanie","twitter_misc":{"Written by":"Daniel Westermann","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/"},"author":{"name":"Daniel Westermann","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"headline":"Getting started with Docker \u2013 2 \u2013 building your own base image","datePublished":"2016-12-12T18:30:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/"},"wordCount":530,"commentCount":0,"keywords":["Docker","PostgreSQL"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/","url":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/","name":"Getting started with Docker \u2013 2 \u2013 building your own base image - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2016-12-12T18:30:41+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-docker-2-building-your-own-base-image\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Getting started with Docker \u2013 2 \u2013 building your own base image"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66","name":"Daniel Westermann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","caption":"Daniel Westermann"},"description":"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.","sameAs":["https:\/\/x.com\/westermanndanie"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=9544"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9544\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=9544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=9544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=9544"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=9544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}