{"id":7882,"date":"2023-10-06T15:44:27","date_gmt":"2023-10-06T23:44:27","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=7882"},"modified":"2025-04-24T17:05:35","modified_gmt":"2025-04-24T17:05:35","slug":"wrapping-a-comet-experiment-in-docker","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/","title":{"rendered":"Wrapping a Comet Experiment in Docker"},"content":{"rendered":"\n<figure class=\"wp-block-image mr ms mt mu mv mw mo mp paragraph-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo by <a class=\"af ni\" href=\"https:\/\/unsplash.com\/@lukepeters?utm_source=medium&amp;utm_medium=referral\" target=\"_blank\" rel=\"noopener ugc nofollow\">Luke Peters<\/a> on <a class=\"af ni\" href=\"https:\/\/unsplash.com\/?utm_source=medium&amp;utm_medium=referral\" target=\"_blank\" rel=\"noopener ugc nofollow\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"0f16\">Using <a class=\"af ni\" href=\"https:\/\/www.comet.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Comet<\/a> to track your experiments can improve your performance as a Data Scientist because <strong class=\"be oe\">Comet helps you to organize your code, compare your implemented models, and select the best model.<\/strong> Once you have selected the best model, you can build a prediction service, which you can then send to production for implementation. And here is where DevOps comes in, with all its best practices and strategies to run your code.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"6a8b\"><strong class=\"be oe\">DevOps permits you to integrate the development phase with the operational one, in which all the context around your code should be configured.<\/strong> The context around the code could include the environment variables, the required packages needed to run the code, and so on.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"094e\">To integrate the software with its context, you may use a <a class=\"af ni\" href=\"https:\/\/www.docker.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Docker image<\/a>, which is a standalone runnable system, which you can run everywhere, provided that the hosting machine runs a Docker engine. In the previous example, you can build a Docker image that contains your prediction service, and then run it in a Docker container.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"592e\">Many tutorials exist on how to build a Docker image to run your code. <strong class=\"be oe\">But what about building a Docker image for your Comet experiments?<\/strong> It would be great if you built a Docker image that tracks your experiments in Comet! You could download it from the Docker Hub, then configure it with your Comet API key, and finally run it in a Docker container.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"804a\">In this article, I will describe exactly this process, by means of an example.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"4658\">The article is organized as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Overview of the use case<\/li>\n\n\n\n<li>Wrapping the Comet experiment in a Docker image<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading oq or fq be os ot ou gv ov ow ox gy oy oz pa pb pc pd pe pf pg ph pi pj pk pl bj\" id=\"10d7\">Overview of the use case<\/h1>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt pm nm nn gw pn np nq nr po nt nu nv pp nx ny nz pq ob oc od fj bj\" id=\"44cc\">As an example, I use the well-known <a class=\"af ni\" href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.datasets.load_diabetes.html#sklearn.datasets.load_diabetes\" target=\"_blank\" rel=\"noopener ugc nofollow\">diabetes<\/a> dataset, provided by the scikit-learn library, and I build a Linear Regression model. Then, I calculate Mean Squared Error (MSE) and R2 score, and I log them as metrics in Comet.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"88bc\">Firstly, I import all the required libraries:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"b985\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">import os\nfrom comet_ml import Experiment\nfrom sklearn.datasets import load_diabetes\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import mean_squared_error, r2_score<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"ebb5\">Secondly, I load the Comet configuration parameters from the environment variables. This will be useful when I will build the Docker image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"3ccb\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">COMET_API_KEY = os.environ.get(\"COMET_API_KEY\")\nCOMET_WORKSPACE = os.environ.get(\"COMET_WORKSPACE\")\nCOMET_PROJECT = os.environ.get(\"COMET_PROJECT\")<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"f082\">I load the dataset, and I split it into training and test set:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"b100\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">data = load_diabetes()\nX = data.data\ny = data.target<\/span><span id=\"d5a9\" class=\"pw or fq ps b ig qa py l iz pz\" data-selectable-paragraph=\"\">X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"6dbf\">I build the Linear Regression model, and I calculate MSE and R2 score:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"5099\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">model = LinearRegression()\nmodel.fit(X_train, y_train)\ny_pred = model.predict(X_test)<\/span><span id=\"60e8\" class=\"pw or fq ps b ig qa py l iz pz\" data-selectable-paragraph=\"\">mse =  mean_squared_error(y_test, y_pred)\nr2_score = r2_score(y_test, y_pred)<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"4d1c\">Finally, I build a Comet experiment, and I log the calculated metrics:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"d0aa\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">experiment = Experiment(\n   api_key=COMET_API_KEY,\n   project_name=COMET_PROJECT,\n   workspace=COMET_WORKSPACE,\n)<\/span><span id=\"1701\" class=\"pw or fq ps b ig qa py l iz pz\" data-selectable-paragraph=\"\">experiment.log_metric('mse', mse)\nexperiment.log_metric('r2', r2_score)<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"e66e\">I can test the code as follows. In a terminal, I set the Comet parameters:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"2af2\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">export COMET_API_KEY=MY_API_KEY\nexport COMET_PROJECT=MY_COMET_PROJECT\nexport COMET_WORKSPACE=MY_COMET_WORKSPACE<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"9766\">and then I run the script:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"3f6b\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">python test_model.py<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"65a0\">I should be able to see the results in Comet, as shown in the following figure:<\/p>\n\n\n\n<figure class=\"wp-block-image mr ms mt mu mv mw mo mp paragraph-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*OqTSP6rks9uf56Ej9wc0Yw.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Image by Author<\/figcaption><\/figure>\n\n\n\n<h1 class=\"wp-block-heading oq or fq be os ot ou gv ov ow ox gy oy oz pa pb pc pd pe pf pg ph pi pj pk pl bj\" id=\"5942\">Wrapping the Comet experiment in a Docker image<\/h1>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt pm nm nn gw pn np nq nr po nt nu nv pp nx ny nz pq ob oc od fj bj\" id=\"5e2b\">Before building a Docker image with my Comet experiment, I need to download and install <a class=\"af ni\" href=\"https:\/\/www.docker.com\/get-started\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Docker Desktop<\/a>. Once installed, I can proceed as follows.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"89ea\">I need to write two files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>requirements.txt<\/li>\n\n\n\n<li>Dockerfile<\/li>\n<\/ul>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"adad\">The <code class=\"cw qc qd qe ps b\">requirements.txt<\/code> file contains all the Python libraries required by the previous script. It is a plain text, that contains a library per line, as shown in the following piece of code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"d60a\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">comet_ml\nscikit-learn<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"2ed7\">The Dockerfile contains the directives used to build the Docker image. It defines the base image from which you should build the image. In my case, I can use a slim version of Python:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"5ec3\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">FROM python:slim<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"38f7\">Now, I specify that I want to copy all the content of the current directory to the image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"20fe\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">COPY . .<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"740a\">Next, I install all the required packages:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"c7bd\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">RUN pip install --no-cache-dir -r requirements.txt<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"f01d\">Finally, I set the operation to perform when the image is run in a Docker container:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"e4e4\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">CMD [\"python\", \".\/test_model.py\"]<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"f6e3\">I save the file as <code class=\"cw qc qd qe ps b\">Dockerfile<\/code>.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"6fd3\">Eventually, I am ready to build the Docker image. I open a terminal, and I enter the directory containing all my files:<\/p>\n\n\n\n<figure class=\"wp-block-image mr ms mt mu mv mw mo mp paragraph-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:558\/1*tS97lgxvqZ2z_erMGvDVew.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Image by Author<\/figcaption><\/figure>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"18ba\">From that directory, I run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"10ac\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">docker build -t cm .<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"1963\">The <code class=\"cw qc qd qe ps b\">-t <\/code>parameter specifies the name of the docker image. The building process starts.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"26e7\">When the process finishes, I should be able to see your image by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"7a05\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">docker images<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"6bc9\">which should give an output similar to the following one:<\/p>\n\n\n\n<figure class=\"wp-block-image mr ms mt mu mv mw mo mp paragraph-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*NcetnWxshY-VOtK3arUGaQ.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">image by Author<\/figcaption><\/figure>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"53ff\">Before running the image in a Docker container, I need to specify the environment variables. I can define a file, named env.list, which contains the Comet configuration parameters:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"0365\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">COMET_API_KEY=MY_COMET_API\nCOMET_PROJECT=MY_COMET_PROJECT\nCOMET_WORKSPACE=MY_COMET_WORKSPACE<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"cade\">Finally, I can run the Docker image in a Docker container:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span id=\"1c75\" class=\"pw or fq ps b ig px py l iz pz\" data-selectable-paragraph=\"\">docker run --env-file \/path\/to\/env.list --rm cm<\/span><\/pre>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"402b\">You should be able to view the results in Comet!<\/p>\n\n\n\n<h1 class=\"wp-block-heading oq or fq be os ot ou gv ov ow ox gy oy oz pa pb pc pd pe pf pg ph pi pj pk pl bj\" id=\"421c\">Summary<\/h1>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt pm nm nn gw pn np nq nr po nt nu nv pp nx ny nz pq ob oc od fj bj\" id=\"947e\">Congratulations! You have just learned how to integrate a Comet experiment in a Docker image, and then run it as a Docker container! The process is quite simple, you only need to write:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>the code of your Comet experiment<\/li>\n\n\n\n<li>the <code class=\"cw qc qd qe ps b\">requirements.txt<\/code> file with all the required libraries<\/li>\n\n\n\n<li>the <code class=\"cw qc qd qe ps b\">Dockerfile<\/code> with the building process.<\/li>\n<\/ul>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"2edb\">Comet is very powerful to build and track your experiments. You may also be interested in other features provided by Comet, including <a class=\"af ni\" href=\"https:\/\/heartbeat.comet.ml\/how-to-write-your-comet-experiments-in-r-dd44f07041aa\" target=\"_blank\" rel=\"noopener ugc nofollow\">How to Write your Comet Experiments in R<\/a> and <a class=\"af ni\" href=\"https:\/\/heartbeat.comet.ml\/writing-a-classification-task-using-comet-and-java-d929d1ef9f4e\" target=\"_blank\" rel=\"noopener ugc nofollow\">Writing a Classification Task using Comet and Java<\/a>.<\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"0eb5\">Stay tuned for new tutorials on Comet and don\u2019t forget you can <a class=\"af ni\" href=\"https:\/\/www.comet.com\/site\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">get started for free!<\/a><\/p>\n\n\n\n<p class=\"pw-post-body-paragraph nj nk fq be b gt nl nm nn gw no np nq nr ns nt nu nv nw nx ny nz oa ob oc od fj bj\" id=\"4e92\">Happy Coding! Happy <a class=\"af ni\" href=\"https:\/\/www.comet.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Comet<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Comet to track your experiments can improve your performance as a Data Scientist because Comet helps you to organize your code, compare your implemented models, and select the best model. Once you have selected the best model, you can build a prediction service, which you can then send to production for implementation. And here [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[9,7],"tags":[],"coauthors":[132],"class_list":["post-7882","post","type-post","status-publish","format-standard","hentry","category-product","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Wrapping a Comet Experiment in Docker - Comet<\/title>\n<meta name=\"description\" content=\"Learn how to integrate a Comet experiment in a Docker image, and then run it as a Docker container in this article.\" \/>\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.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wrapping a Comet Experiment in Docker\" \/>\n<meta property=\"og:description\" content=\"Learn how to integrate a Comet experiment in a Docker image, and then run it as a Docker container in this article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-06T23:44:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:05:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb\" \/>\n<meta name=\"author\" content=\"Angelica Lo Duca\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Angelica Lo Duca\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Wrapping a Comet Experiment in Docker - Comet","description":"Learn how to integrate a Comet experiment in a Docker image, and then run it as a Docker container in this article.","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.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/","og_locale":"en_US","og_type":"article","og_title":"Wrapping a Comet Experiment in Docker","og_description":"Learn how to integrate a Comet experiment in a Docker image, and then run it as a Docker container in this article.","og_url":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-10-06T23:44:27+00:00","article_modified_time":"2025-04-24T17:05:35+00:00","og_image":[{"url":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb","type":"","width":"","height":""}],"author":"Angelica Lo Duca","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Angelica Lo Duca","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/"},"author":{"name":"Team Comet Digital","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/6266601170c60a7a82b3e0043fbe8ddf"},"headline":"Wrapping a Comet Experiment in Docker","datePublished":"2023-10-06T23:44:27+00:00","dateModified":"2025-04-24T17:05:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/"},"wordCount":822,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb","articleSection":["Product","Tutorials"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/","url":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/","name":"Wrapping a Comet Experiment in Docker - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb","datePublished":"2023-10-06T23:44:27+00:00","dateModified":"2025-04-24T17:05:35+00:00","description":"Learn how to integrate a Comet experiment in a Docker image, and then run it as a Docker container in this article.","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#primaryimage","url":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb","contentUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/0*Iv6O55JLjVofB9kb"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/wrapping-a-comet-experiment-in-docker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Wrapping a Comet Experiment in Docker"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/6266601170c60a7a82b3e0043fbe8ddf","name":"Team Comet Digital","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/4f0c0a8cc7c0e87c636ff6a420a6647c","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/Screen-Shot-2023-08-12-at-8.58.50-AM-96x96.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/Screen-Shot-2023-08-12-at-8.58.50-AM-96x96.png","caption":"Team Comet Digital"},"sameAs":["https:\/\/www.comet.ml\/"],"url":"https:\/\/www.comet.com\/site\/blog\/author\/teamcometdigital\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=7882"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7882\/revisions"}],"predecessor-version":[{"id":15500,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7882\/revisions\/15500"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=7882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=7882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=7882"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=7882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}