{"id":11759,"date":"2018-10-08T11:26:00","date_gmt":"2018-10-08T09:26:00","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/"},"modified":"2018-10-08T11:26:00","modified_gmt":"2018-10-08T09:26:00","slug":"deploy-a-mysql-server-in-docker-containers","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/","title":{"rendered":"Deploy a MySQL Server in Docker containers"},"content":{"rendered":"<p>We hear about Docker every day. By working on MySQL Server, I am curious to test this platform which makes it possible to create containers independent of the OS to deploy virtualized applications.<br \/>\nSo let&#8217;s try to deploy a MySQL Server with Docker!<\/p>\n<p>Here is the architecture we will put in place:<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png\" alt=\"MySQL on Docker\" width=\"98\" height=\"100\" class=\"alignnone size-medium wp-image-28370\" \/><\/a><br \/>\nSo we will run a Docker container for MySQL within a VM.<\/p>\n<p>I&#8217;m working on a CentOS 7 installed on a VirtualBox Machine:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# cat \/etc\/*release*\nCentOS Linux release 7.5.1804 (Core)\nDerived from Red Hat Enterprise Linux 7.5 (Source)\n<\/pre>\n<p>I install Docker on my VM and enable the Docker service:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# yum install docker\n[root@node4 ~]# systemctl enable docker.service\n<\/pre>\n<p>I start the Docker service:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# systemctl status docker.service\n\u25cf docker.service - Docker Application Container Engine\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/docker.service; enabled; vendor preset: disabled)\n   Active: inactive (dead)\n     Docs: http:\/\/docs.docker.com\n[root@node4 ~]# systemctl stop docker.service\n[root@node4 ~]# systemctl status docker.service\n\u25cf docker.service - Docker Application Container Engine\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/docker.service; enabled; vendor preset: disabled)\n   Active: inactive (dead)\n     Docs: http:\/\/docs.docker.com\n[root@node4 ~]# systemctl start docker.service\n[root@node4 ~]# systemctl status docker.service\n\u25cf docker.service - Docker Application Container Engine\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/docker.service; enabled; vendor preset: disabled)\n   Active: active (running) since Fri 2018-10-05 16:42:33 CEST; 2s ago\n     Docs: http:\/\/docs.docker.com\n Main PID: 1514 (dockerd-current)\n   CGroup: \/system.slice\/docker.service\n           \u251c\u25001514 \/usr\/bin\/dockerd-current --add-runtime docker-runc=\/usr\/libexec\/docker\/docker-runc-current --default-runtime=docker-runc --exec-opt nati...\n           \u2514\u25001518 \/usr\/bin\/docker-containerd-current -l unix:\/\/\/var\/run\/docker\/libcontainerd\/docker-containerd.sock --metrics-interval=0 --start-timeout 2...\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.561072533+02:00\" level=warning msg=\"Docker could not enable SELinux on the...t system\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.597927636+02:00\" level=info msg=\"Graph migration to content-addressability... seconds\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.598407196+02:00\" level=info msg=\"Loading containers: start.\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.642465451+02:00\" level=info msg=\"Firewalld running: false\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.710685631+02:00\" level=info msg=\"Default bridge (docker0) is assigned with... address\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.762876995+02:00\" level=info msg=\"Loading containers: done.\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.780275247+02:00\" level=info msg=\"Daemon has completed initialization\"\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.780294728+02:00\" level=info msg=\"Docker daemon\" commit=\"8633870\/1.13.1\" gr...on=1.13.1\nOct 05 16:42:33 node4 systemd[1]: Started Docker Application Container Engine.\nOct 05 16:42:33 node4 dockerd-current[1514]: time=\"2018-10-05T16:42:33.799371435+02:00\" level=info msg=\"API listen on \/var\/run\/docker.sock\"\nHint: Some lines were ellipsized, use -l to show in full.\n<\/pre>\n<p>I check my network:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1; highlight: [20,21,22,23,26]\">\n[root@node4 ~]# ip a\n1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000\n    link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n    inet 127.0.0.1\/8 scope host lo\n       valid_lft forever preferred_lft forever\n    inet6 ::1\/128 scope host\n       valid_lft forever preferred_lft forever\n2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n    link\/ether 08:00:27:f3:9e:fa brd ff:ff:ff:ff:ff:ff\n    inet 10.0.2.15\/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3\n       valid_lft 85959sec preferred_lft 85959sec\n    inet6 fe80::a00:27ff:fef3:9efa\/64 scope link\n       valid_lft forever preferred_lft forever\n3: enp0s8:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n    link\/ether 08:00:27:45:62:a7 brd ff:ff:ff:ff:ff:ff\n    inet 192.168.56.204\/24 brd 192.168.56.255 scope global noprefixroute enp0s8\n       valid_lft forever preferred_lft forever\n    inet6 fe80::a00:27ff:fe45:62a7\/64 scope link\n       valid_lft forever preferred_lft forever\n4: docker0:  mtu 1500 qdisc noqueue state DOWN group default\n    link\/ether 02:42:b0:bf:02:d6 brd ff:ff:ff:ff:ff:ff\n    inet 172.17.0.1\/16 scope global docker0\n       valid_lft forever preferred_lft forever\n[root@node4 ~]# docker network ls\nNETWORK ID          NAME                DRIVER              SCOPE\nb32241ce8931        bridge              bridge              local\n9dd4a24a4e61        host                host                local\nf1490ec17c17        none                null                local\n<\/pre>\n<p>So I have a network bridge named docker0 to which an IP address is assigned.<\/p>\n<p>To obtain some information about the system, I can run the following command:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker info\nContainers: 0\n Running: 0\n Paused: 0\n Stopped: 0\nImages: 0\nServer Version: 1.13.1\nStorage Driver: overlay2\n Backing Filesystem: xfs\n Supports d_type: false\n Native Overlay Diff: true\nLogging Driver: journald\nCgroup Driver: systemd\nPlugins:\n Volume: local\n Network: bridge host macvlan null overlay\nSwarm: inactive\nRuntimes: docker-runc runc\nDefault Runtime: docker-runc\nInit Binary: \/usr\/libexec\/docker\/docker-init-current\ncontainerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)\nrunc version: 5eda6f6fd0c2884c2c8e78a6e7119e8d0ecedb77 (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)\ninit version: fec3683b971d9c3ef73f284f176672c44b448662 (expected: 949e6facb77383876aeff8a6944dde66b3089574)\nSecurity Options:\n seccomp\n  WARNING: You're not using the default seccomp profile\n  Profile: \/etc\/docker\/seccomp.json\nKernel Version: 3.10.0-862.3.2.el7.x86_64\nOperating System: CentOS Linux 7 (Core)\nOSType: linux\nArchitecture: x86_64\nNumber of Docker Hooks: 3\nCPUs: 1\nTotal Memory: 867.7 MiB\nName: node4\nID: 6FFJ:Z33K:PYG3:2N4B:MZDO:7OUF:R6HW:ES3D:H7EK:MFLA:CAJ3:GF67\nDocker Root Dir: \/var\/lib\/docker\nDebug Mode (client): false\nDebug Mode (server): false\nRegistry: https:\/\/index.docker.io\/v1\/\nExperimental: false\nInsecure Registries:\n 127.0.0.0\/8\nLive Restore Enabled: false\nRegistries: docker.io (secure)\n<\/pre>\n<p>For the moment I have no containers:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker ps -a\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\n<\/pre>\n<p>Now I can search the Docker Hub for MySQL images, and I pull the first one in my example (I normally chose an official build with the biggest number of stars):<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker search --filter \"is-official=true\" --filter \"stars=3\" mysql\nINDEX       NAME                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED\ndocker.io   docker.io\/mysql     MySQL is a widely used, open-source relati...   7075      [OK]\ndocker.io   docker.io\/mariadb   MariaDB is a community-developed fork of M...   2267      [OK]\ndocker.io   docker.io\/percona   Percona Server is a fork of the MySQL rela...   376       [OK]\n[root@node4 ~]# docker pull docker.io\/mysql\nUsing default tag: latest\nTrying to pull repository docker.io\/library\/mysql ...\nlatest: Pulling from docker.io\/library\/mysql\n802b00ed6f79: Pull complete\n30f19a05b898: Pull complete\n3e43303be5e9: Pull complete\n94b281824ae2: Pull complete\n51eb397095b1: Pull complete\n54567da6fdf0: Pull complete\nbc57ddb85cce: Pull complete\nd6cd3c7302aa: Pull complete\nd8263dad8dbb: Pull complete\n780f2f86056d: Pull complete\n8e0761cb58cd: Pull complete\n7588cfc269e5: Pull complete\nDigest: sha256:038f5f6ea8c8f63cfce1bce9c057ab3691cad867e18da8ad4ba6c90874d0537a\nStatus: Downloaded newer image for docker.io\/mysql:latest\n<\/pre>\n<p>I create my container for MySQL named mysqld1:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker run -d --name mysqld1 docker.io\/mysql\nb058fba64c7e585caddfc75f5d96076edb3e80b31773f135d9e44a3487724914\n<\/pre>\n<p>But if I list it, I see that I have a problem, it has exited with an error:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker ps -a\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES\nb058fba64c7e        docker.io\/mysql     \"docker-entrypoint...\"   55 seconds ago      Exited (1) 54 seconds ago                       mysqld1\n[root@node4 ~]# docker logs mysqld1\nerror: database is uninitialized and password option is not specified\n  You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD\n<\/pre>\n<p>That means that I forgot password assignment for the &#8216;root&#8217; user account of MySQL Server. So I stop and the remove the container, and create it again with some additional options:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker stop b058fba64c7e\nb058fba64c7e\n[root@node4 ~]# docker rm b058fba64c7e\nb058fba64c7e\n[root@node4 ~]# docker ps -a\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\n[root@node4 ~]# docker run --name mysqld1 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=manager -d docker.io\/mysql\n46a2020f58740d5a87288073ab6292447fe600f961428307d2e2727454655504\n<\/pre>\n<p>Now my container is up and running:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]#  docker ps -a\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES\n46a2020f5874        docker.io\/mysql     \"docker-entrypoint...\"   5 seconds ago       Up 5 seconds        0.0.0.0:3306-&gt;3306\/tcp, 33060\/tcp   mysqld1\n<\/pre>\n<p>I can execute a bash shell on the container in an interactive mode to open a session on it:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@node4 ~]# docker exec -it mysqld1 bash\nroot@46a2020f5874:\/#\n<\/pre>\n<p>And try to connect to MySQL Server:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1; highlight: [5]\">\nroot@46a2020f5874:\/# mysql -uroot -p\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 8\nServer version: 8.0.12 MySQL Community Server - GPL\nCopyright (c) 2000, 2018, Oracle and\/or its affiliates. All rights reserved.\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\nmysql&gt; show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| mysql              |\n| performance_schema |\n| sys                |\n+--------------------+\n4 rows in set (0.02 sec)\n<\/pre>\n<p>Great news, everything works well! In a few minutes I have a MySQL Server on his latest version up and running in a Docker container.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We hear about Docker every day. By working on MySQL Server, I am curious to test this platform which makes it possible to create containers independent of the OS to deploy virtualized applications. So let&#8217;s try to deploy a MySQL Server with Docker! Here is the architecture we will put in place: So we will&hellip;&nbsp;<\/p>\n","protected":false},"author":28,"featured_media":11760,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133,1320,1316],"tags":[],"class_list":["post-11759","post","type-post","status-publish","format-standard","has-post-thumbnail","category-database","category-devops","category-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Deploy a MySQL Server in Docker containers - dbi services 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\/deploy-a-mysql-server-in-docker-containers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploy a MySQL Server in Docker containers\" \/>\n<meta property=\"og:description\" content=\"We hear about Docker every day. By working on MySQL Server, I am curious to test this platform which makes it possible to create containers independent of the OS to deploy virtualized applications. So let&#8217;s try to deploy a MySQL Server with Docker! Here is the architecture we will put in place: So we will&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-08T09:26:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png\" \/>\n\t<meta property=\"og:image:width\" content=\"395\" \/>\n\t<meta property=\"og:image:height\" content=\"402\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 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\\\/deploy-a-mysql-server-in-docker-containers\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\"},\"headline\":\"Deploy a MySQL Server in Docker containers\",\"datePublished\":\"2018-10-08T09:26:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/\"},\"wordCount\":284,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/MySQL-on-Docker.png\",\"articleSection\":[\"Database\",\"DevOps\",\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/\",\"name\":\"Deploy a MySQL Server in Docker containers - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/MySQL-on-Docker.png\",\"datePublished\":\"2018-10-08T09:26:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/MySQL-on-Docker.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/MySQL-on-Docker.png\",\"width\":395,\"height\":402},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/deploy-a-mysql-server-in-docker-containers\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deploy a MySQL Server in Docker containers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"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\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"caption\":\"Open source Team\"},\"description\":\"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/open-source-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Deploy a MySQL Server in Docker containers - dbi services 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\/deploy-a-mysql-server-in-docker-containers\/","og_locale":"en_US","og_type":"article","og_title":"Deploy a MySQL Server in Docker containers","og_description":"We hear about Docker every day. By working on MySQL Server, I am curious to test this platform which makes it possible to create containers independent of the OS to deploy virtualized applications. So let&#8217;s try to deploy a MySQL Server with Docker! Here is the architecture we will put in place: So we will&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2018-10-08T09:26:00+00:00","og_image":[{"width":395,"height":402,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png","type":"image\/png"}],"author":"Open source Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Open source Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a"},"headline":"Deploy a MySQL Server in Docker containers","datePublished":"2018-10-08T09:26:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/"},"wordCount":284,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png","articleSection":["Database","DevOps","MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/","url":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/","name":"Deploy a MySQL Server in Docker containers - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png","datePublished":"2018-10-08T09:26:00+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/MySQL-on-Docker.png","width":395,"height":402},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/deploy-a-mysql-server-in-docker-containers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Deploy a MySQL Server in Docker containers"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"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":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","caption":"Open source Team"},"description":"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.","url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11759","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\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=11759"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11759\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/11760"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=11759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=11759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=11759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}