PageSourceSearch

https://www.minizinc.org/_next/static/chunks/pages/challenge/2022/docker-0a34f9d4e6ab0004.js

js minizinc.org collected 2026-09-24 09:28:34 UTC 25,866 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8299],{48378:(e,n,i)=>{"use strict";i.d(n,{B:()=>o});var r=i(37876),s=i(69241),t=i(37472);function o({className:e,items:n}){return e=(0,s.A)("flex items-center my-4",e),(0,r.jsx)("ul",{className:e,children:n.map((e,n)=>(0,r.jsxs)("li",{className:"flex items-center",children:[n>0?(0,r.jsx)("span",{className:"px-1 text-gray-400",children:"\xbb"}):(0,r.jsx)(r.Fragment,{}),"string"==typeof e?(0,r.jsx)("span",{children:e}):(0,r.jsx)(t.N,{href:e[1],children:e[0]})]},n))})}},50380:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>u});var r=i(37876),s=i(91668),t=i(63141),o=i(99638),c=i(85931),l=i(48378),a=i(77328),d=i.n(a);let h=function({children:e}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d(),{children:(0,r.jsx)("title",{children:"MiniZinc - Challenge 2022 Docker Image Praparation"})}),(0,r.jsx)(c.Y,{}),(0,r.jsx)("main",{children:(0,r.jsx)(t.m,{children:(0,r.jsx)("article",{className:"prose prose-minizinc max-w-none py-6",children:e})})}),(0,r.jsx)(o.w,{})]})};function m(e){let n={a:"a",blockquote:"blockquote",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"prepare-a-docker-image-for-the-minizinc-challenge-2022",children:"Prepare a Docker image for the MiniZinc Challenge 2022"}),"\n",(0,r.jsx)(l.B,{className:"not-prose",items:[["MiniZinc Challenge","/challenge"],["Challenge 2022","/challenge/2022"],"Docker image preparation"]}),"\n",(0,r.jsx)(n.h3,{id:"quick-summary",children:"Quick Summary"}),"\n",(0,r.jsx)(n.p,{children:"For those who are familiar with Docker, an image suitable for submission to the MiniZinc Challenge\nmust comply wih the following requirements:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Your image must use the base image of ",(0,r.jsx)(n.code,{children:"minizinc/mznc2022:latest"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Running ",(0,r.jsx)(n.code,{children:"minizinc"})," with the default solver (i.e. without the ",(0,r.jsx)(n.code,{children:"--solver"})," option) must run your\nsolver. This can be achieved through one of the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["If you have a ",(0,r.jsx)(n.a,{href:"/doc-2.6.3/en/fzn-spec.html#solver-configuration-files",children:"solver configuration file"}),"\n(",(0,r.jsx)(n.code,{children:".msc"}),") for your solver (recommended), you must add it to the user configuration file as the\ndefault solver."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-docker",children:'RUN echo \'{"mzn_solver_path": ["/path/with/msc/],\'        > $HOME/.minizinc/Preferences.json && \\\n    echo \'"tagDefaults": [["", "org.myorg.my_solver"]]}\' >> $HOME/.minizinc/Preferences.json\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Note that MiniZinc solvers using a solver configuration file will have to add ",(0,r.jsx)(n.code,{children:"--output-mode"}),"\nand ",(0,r.jsx)(n.code,{children:"--output-objective"})," to the extra flags section of the configuration to declare support for\nthese flags."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["If you do not have a solver configuration file and are submitting a FlatZinc solver, you can\nplace its executable at ",(0,r.jsx)(n.code,{children:"/entry_data/fzn-exec"})," and its MiniZinc library at\n",(0,r.jsx)(n.code,{children:"/entry_data/mzn-lib/"}),". Alternatively you may modify ",(0,r.jsx)(n.code,{children:"/minizinc/mzn-exec-fd"}),",\n",(0,r.jsx)(n.code,{children:"/minizinc/mzn-exec-free"})," and ",(0,r.jsx)(n.code,{children:"/minizinc/mzn-exec-par"})," as appropriate for your solver's entry\nclasses, to run your solver command."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["If you do not have a solver configuration file and are submitting a MiniZinc solver, you\nmust modify ",(0,r.jsx)(n.code,{children:"/minizinc/mzn-exec-fd"}),", ",(0,r.jsx)(n.code,{children:"/minizinc/mzn-exec-free"})," and ",(0,r.jsx)(n.code,{children:"/minizinc/mzn-exec-par"})," as\nappropriate for your solver's entry classes, to run your solver command."]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"You can test if your submission functions as required by running the command for the entry class\nyou are participating in:"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Class"}),(0,r.jsx)(n.th,{children:"Command"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"FD"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"docker run --rm <repository>:<tag> minizinc fd.mpc /minizinc/test.mzn /minizinc/2.dzn"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"FREE"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"docker run --rm <repository>:<tag> minizinc free.mpc /minizinc/test.mzn /minizinc/2.dzn"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"PAR"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"docker run --rm <repository>:<tag> minizinc par.mpc /minizinc/test.mzn /minizinc/2.dzn"})})]})]})]}),"\n",(0,r.jsx)(n.p,{children:"Push your image to Docker Hub and complete the web form (which will be made available to\nparticipants at the start of the initial submission round) to 
1submit your entry."}),"\n",(0,r.jsx)(n.h3,{id:"solver-submission",children:"Solver Submission"}),"\n",(0,r.jsxs)(n.p,{children:["In order to submit your solver, you must install it into a\n",(0,r.jsx)(n.a,{href:"https://docs.docker.com/get-started/overview/",children:"Docker"})," image that extends a base operating system\nimage (Ubuntu 20.04 with MiniZinc installed) which we provide. To do this, you will create a\n",(0,r.jsx)(n.code,{children:"Dockerfile"})," - a set of instructions indicating how to (build and) install your solver on to the\nbase operating system image."]}),"\n",(0,r.jsx)(n.p,{children:"The submitted image must have your solver set as the default MiniZinc solver."}),"\n",(0,r.jsx)(n.h4,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Install Docker Engine by following the instructions ",(0,r.jsx)(n.a,{href:"https://docs.docker.com/engine/install/",children:"here"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Register an account on ",(0,r.jsx)(n.a,{href:"https://hub.docker.com",children:"Docker Hub"})," to which you will upload your image\nso that the Challenge organisers can access it."]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"If you do not wish to make your image publicly available and are unable to create a private repository,\ncontact the MiniZinc Challenge organisers to arrange an alternative image submission method."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"minizinc-challenge-2022-docker-image",children:"MiniZinc Challenge 2022 Docker Image"}),"\n",(0,r.jsxs)(n.p,{children:["The Docker base image, which all entries must extend, was created via a ",(0,r.jsx)(n.a,{href:"/challenge/2022/dockerfiles/mznc2022/Dockerfile",children:"Dockerfile"}),"\nand is available at the repository ",(0,r.jsx)(n.code,{children:"minizinc/mznc2022"})," with the tag ",(0,r.jsx)(n.code,{children:"latest"}),".\nPull the repository via command line using this command (you should re-run this command if we\nannounce that we have made changes to the base image)."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"docker pull minizinc/mznc2022:latest\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The image contains a minimal installation of Ubuntu 20.04 and MiniZinc 2.6.3, which is installed in\nthe ",(0,r.jsx)(n.code,{children:"/usr/local/bin"})," directory. It is recommended that you create a\n",(0,r.jsx)(n.a,{href:"/doc-2.6.3/en/fzn-spec.html#solver-configuration-files",children:"Solver Configuration File"})," for your solver,\nand set it as the default solver using a\n",(0,r.jsx)(n.a,{href:"/doc-2.6.3/en/command_line.html#user-configuration-files",children:"User Configuration File"})," (the details\nof how to do this are in the following section), however the\nmethod of setting up scripts as in previous years is still available."]}),"\n",(0,r.jsx)(n.p,{children:"If you want to inspect the image via a bash shell, use the following command:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"docker run -it --rm minizinc/mznc2022 /bin/bash\n"})}),"\n",(0,r.jsx)(n.h3,{id:"dockerfile",children:"Dockerfile"}),"\n",(0,r.jsx)(n.h4,{id:"solver-entry-dockerfile",children:"Solver Entry Dockerfile"}),"\n",(0,r.jsxs)(n.p,{children:["As an example, we will create a ",(0,r.jsx)(n.code,{children:"Dockerfile"})," in order to submit an entry for\n",(0,r.jsx)(n.a,{href:"https://github.com/chuffed/chuffed",children:"Chuffed"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"Chuffed is built using GCC and CMake, so our Dockerfile will have to install them in order to\ncompile Chuffed. However, we do not want to include these tools in the final image. Therefore,\nwe will create a separate build stage to compile Chuffed in, and then copy just the required files\nfrom this stage into the final image."}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"Dockerfile"})," will perform the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["In an isolated build stage:","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Install build tools required to fetch and compile Chuffed."}),"\n",(0,r.jsx)(n.li,{children:"Fetch, compile, and install Chuffed."}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.li,{children:"Copy the installed solver to the final image (so that the compiler toolchain is not in the final image)."}),"\n",(0,r.jsx)(n.li,{children:"Ensure Chuffed can be located by MiniZinc and is the default solver."}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Create a file called ",(0,r.jsx)(n.code,{children:"Dockerfile"}
1)," and add the following (see comments for explanations):"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-docker",children:'# Build Chuffed in an isolated stage called builder.\n#\n# The FROM statement begins a new stage in the image creation process.\n# You specify the base image for following statements to use.\n# We\'re giving this one a name using AS, so that we can refer to it\n# and copy files from it later on.\nFROM minizinc/mznc2022:latest AS builder\n\n# Install compiler toolchain for Chuffed.\n#\n# The RUN statement runs the given command in the image.\n# Note the use of DEBIAN_FRONTEND=noninteractive to ensure that apt does\n# not prompt for user input such as time zones.\nRUN apt-get update -y && \\\n    DEBIAN_FRONTEND=noninteractive apt-get install -y bison build-essential cmake flex git\n\n# Change directory to /src.\n#\n# WORKDIR sets the working directory for the following statements\n# until the end of the stage (it creates it if it doesn\'t exist).\nWORKDIR /src\n\n# Clone the Chuffed git repository.\nRUN git clone https://github.com/chuffed/chuffed . && \\\n    git checkout develop\n\n# Build Chuffed and install it into /install.\nRUN mkdir /install && mkdir build && cd build && \\\n    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/install .. && \\\n    cmake --build . --config Release && \\\n    cmake --build . --config Release --target install\n\n# Create our final image using this base.\n#\n# Since this is the final FROM statement in this Dockerfile,\n# the contents of this stage are what constitutes the final image.\nFROM minizinc/mznc2022:latest\n\n# Copy the Chuffed installation to /chuffed in the final image.\n#\n# The COPY statement copies files from the local computer into the\n# current stage, or from another stage into this stage.\n# We want to copy from the builder stage, so we use --from=builder.\n# If we omitted that, we would copy a file from the local computer.\nCOPY --from=builder /install /chuffed\n\n# Add Chuffed to the MiniZinc search path and set it as the default solver.\n#\n# See https://www.minizinc.org/doc-2.6.3/en/command_line.html#user-configuration-files\nRUN echo \'{"mzn_solver_path": ["/chuffed/share/minizinc/solvers"],\' > $HOME/.minizinc/Preferences.json && \\\n    echo \'"tagDefaults": [["", "org.chuffed.chuffed"]]}\'           >> $HOME/.minizinc/Preferences.json\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Refer to the ",(0,r.jsx)(n.a,{href:"https://docs.docker.com/engine/reference/builder/",children:"Dockerfile reference"})," for more\ninformation about each of the statements."]}),"\n",(0,r.jsx)(n.p,{children:"You can then build the image with"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"docker build -t chuffed:latest .\n"})}),"\n",(0,r.jsx)(n.p,{children:"And check that it functions by running"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"docker run --rm chuffed:latest minizinc /classes/fd.mpc /minizinc/test.mzn /minizinc/2.dzn\n"})}),"\n",(0,r.jsxs)(n.p,{children:["With your own image, replace ",(0,r.jsx)(n.code,{children:"chuffed:latest"})," with an appropriate name for your solver in the format\n",(0,r.jsx)(n.code,{children:"<repository>:<tag>"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Since Chuffed installs a solver configuration file (",(0,r.jsx)(n.code,{children:".msc"}),") into ",(0,r.jsx)(n.code,{children:"share/minizinc/solvers"}),", we can\nadd that path to MiniZinc's solver search path and set it as the default solver using the\n",(0,r.jsx)(n.code,{children:"$HOME/.minizinc/Preferences.json"})," file. If your solver does not yet have a solver configuration\nfile, you can create one by following the instructions in the next section."]}),"\n",(0,r.jsx)(n.h4,{id:"other-example-dockerfiles",children:"Other example Dockerfiles"}),"\n",(0,r.jsx)(n.p,{children:"There are a number of other Dockerfiles and solver configuration files which have been created for\nthe MiniZinc Challenge. They may be used as reference in writing your own."}),"\n",(0,r.jsxs)(n.p,{children:["They are available ",(0,r.jsx)(n.a,{href:"https://github.com/MiniZinc/minizinc.github.io/tree/master/challenge2022/dockerfiles",children:"here"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"In general, a Dockerfile for the MiniZinc Challenge should have (close to) the following structure:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-docker",children:'FROM minizinc/mznc2022:latest AS builder\nRUN apt-get update -y && \\\n    apt-get install -y <your_build_tools>\n\nWORKDIR /src\n\n# Replace with command to clone your solver repository, or COPY the source from\n# the local computer\nRUN git clone https://github.com/<your>/<repo> . && \\\n    git checkout <your_branch>\n\n# Replace with command to build your solver and install it into /install\nRUN mkdir /install && \\\n    <build_your_solver> && \\\n    <install_your_solver_into_/install>\n\nFROM minizinc/mznc2022:latest\n\nRUN apt-get update -y && \\\n    apt-get install -y <your_runtime_dependencies>\n\nCOPY --from=builder /install /my_solver\n\nRUN echo \'{"mzn_solver_path": ["/my_solver/<msc_file_dir>"],\' > $HOME/.minizinc/Preferences.json && \\\n    echo \'"tagDefaults": [["", "org.mysolver.mysolver"]]}\'   >> $HOME/.minizinc/Preferences.json\n'})}),"\n",(0,r.jsxs)(n.p,{children:["If your solver is a prebuilt binary, you can skip the initial ",(0,r.jsx)(n.code,{children:"builder"})," stage and simply ",(0,r.jsx)(n.code,{children:"COPY"})," it\nfrom the local computer (or perhaps use an ",(0,r.jsx)(n.code,{children:"ADD"})," statement to download it from a web address) in the\nfinal stage. However, there may be binary compatibility/dependency issues, so it is recommended that\nyou build your solver from source in the Dockerfile to avoid this."]}),"\n",(0,r.jsx)(n.h3,{id:"using-a-solver-configuration-file",children:"Using a solver configuration file"}),"\n",(0,r.jsxs)(n.p,{children:["A solver configuration file (",(0,r.jsx)(n.code,{children:".msc"}),") is a JSON configuration file specifying how to run your solver.\nIt is the recommended way to add your solver to your image, and it is also the easiest way to\nallow your solver to be installed by others for use with MiniZinc."]}),"\n",(0,r.jsxs)(n.p,{children:["See the documentation ",(0,r.jsx)(n.a,{href:"/doc-2.6.3/en/fzn-spec.html#sec-cmdline-conffiles",children:"here"})," for more information."]}),"\n",(0,r.jsxs)(n.p,{children:["A FlatZinc solver called My Solver which is a binary file ",(0,r.jsx)(n.code,{children:"./fzn-mysolver"})," and a library at\n",(0,r.jsx)(n.code,{children:"./mysolver-mznlib"})," may have the following solver configuration file:"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"./my-solver.msc"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n  "name": "My Solver",\n  "version": "1.0.0",\n  "id": "org.myorg.my_solver",\n  "mznlib": "mysolver-mznlib",\n  "executable": "fzn-mysolver",\n  "stdFlags": ["-a", "-f", "-p"]\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"And use the following Dockerfile:"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"./Dockerfile"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-docker",children:'FROM minizinc/mznc2022\n# Add solver executable to image\nCOPY ./fzn-mysolver /my-solver/\n# Add solver library to image\nCOPY ./mysolver-mznlib /my-solver/\n# Add solver configuration file to image\nCOPY ./my-solver.msc /my-solver/\n# Add solver to search path and make it the default\nRUN echo \'{"mzn_solver_path": ["/my-solver"],\'            > $HOME/.minizinc/Preferences.json && \\\n    echo \'"tagDefaults": [["", "org.myorg.my_solver"]]}\' >> $HOME/.minizinc/Preferences.json\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The most important parts are the ",(0,r.jsx)(n.code,{children:"mznlib"})," and ",(0,r.jsx)(n.code,{children:"executable"})," items for specifying the location of your\nMiniZinc library, and executable, respectively. These are resolved relative to the location of the\nsolver configuration. You can also use an absolute path."]}),"\n",(0,r.jsx)(n.p,{children:"A MiniZinc solver called may use a solver configuration file:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n  "name": "My Solver",\n  "version": "1.0.0",\n  "id": "org.myorg.my_solver",\n  "executable": "mzn-mysolver",\n  "stdFlags": ["-a", "-f", "-p"],\n  "extraFlags": [\n    ["--output-mode", "", "string", ""],\n    ["--output-objective", "", "bool", "false"]\n  ],\n  "supportsMzn": true\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Note the use of ",(0,r.jsx)(n.code,{children:"extraFlags"})," in this case to declare support for the ",(0,r.jsx)(n.code,{children:"--output-mode"})," and\n",(0,r.jsx)(n.code,{children:"--output-objective"})," options. This is not required for FlatZinc solvers."]}),"\n",(0,r.jsx)(n.h3,{id:"setup-using-scriptsfixed-paths",children:"Setup using scripts/fixed paths"}),"\n",(0,r.jsx)(n.p,{children:"If you do not wish to use a solver configuration file, you may use the default one provided in the\nimage, and install your FlatZinc solver to a fixed location, or modify some scripts to execute\nyour solver."}),"\n",(0,r.jsxs)(n.p,{children:["In the MiniZinc directory ",(0,r.jsx)(n.code,{children:"/minizinc"}),", there are the three shell scripts ",(0,r.jsx)(n.code,{children:"mzn-exec-fd"})," (for the FD\nclass), ",(0,r.jsx)(n.code,{children:"mzn-exec-free"})," (for the FREE class), and ",(0,r.jsx)(n.code,{children:"mzn-exec-par"})," (for the PAR class) (these are the\nsame as in previous MiniZinc Challenges). If you submit a MiniZinc solver then you need to modify\nthem accordingly. If you submit a FlatZinc solver then you may 
1need to add, modify, or remove\nparameters that are used for calling your FlatZinc solver. In the case of a FlatZinc solver, there\nmust an executable at ",(0,r.jsx)(n.code,{children:"/entry_data/fzn-exec"})," and the solver's MiniZinc\nlibrary must be located in the folder ",(0,r.jsx)(n.code,{children:"/entry_data/mzn-lib"}),". You should install your solver in the\ndirectory ",(0,r.jsx)(n.code,{children:"/entry_data"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"You may wish to copy the scripts from the base image to your local computer, edit them, and then\ncopy the modified scripts into your submission image."}),"\n",(0,r.jsx)(n.p,{children:"Copy the scripts to the current directory with:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"docker run --rm minizinc/mznc2022:latest cat mzn-exec-fd > mzn-exec-fd\ndocker run --rm minizinc/mznc2022:latest cat mzn-exec-free > mzn-exec-free\ndocker run --rm minizinc/mznc2022:latest cat mzn-exec-par > mzn-exec-par\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Edit them in your editor of choice, and then ",(0,r.jsx)(n.code,{children:"COPY"})," them in your Dockerfile:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-docker",children:"FROM minizinc/mznc2022:latest\n\n# =====================================\n# Install your solver into the image...\n# =====================================\n\n# Copy modified scripts into /minizinc directory\nCOPY ./mzn-exec-fd /minizinc/\nCOPY ./mzn-exec-free /minizinc/\nCOPY ./mzn-exec-par /minizinc/\n"})}),"\n",(0,r.jsx)(n.h3,{id:"creating-an-image-interactively",children:"Creating an Image Interactively"}),"\n",(0,r.jsxs)(n.p,{children:["It is also possible to create an image interactively, however this is ",(0,r.jsx)(n.strong,{children:"not recommended"})," as it\nmakes it rather difficult to make changes to your image, and keep the final image small."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"docker run -it --name solver minizinc/mznc2022:latest /bin/bash\n"})}),"\n",(0,r.jsx)(n.p,{children:"Will bring you into a bash shell, in which you can install your solver and make it the default or\nmodify the scripts as above. To create the final image, run:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"docker commit solver <repository>:<tag>\n"})}),"\n",(0,r.jsxs)(n.p,{children:["If you need to change an environment variable in the final image, you can run ",(0,r.jsx)(n.code,{children:"docker commit"})," with\nthe option ",(0,r.jsx)(n.code,{children:"--change 'ENV MY_VAR=new_value'"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"testing-your-submission",children:"Testing your submission"}),"\n",(0,r.jsx)(n.p,{children:"You can test if your submission functions as required by running the command for the entry class\nyou are participating in:"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Class"}),(0,r.jsx)(n.th,{children:"Command"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"FD"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"docker run --rm <repository>:<tag> minizinc fd.mpc /minizinc/test.mzn /minizinc/2.dzn"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"FREE"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"docker run --rm <repository>:<tag> minizinc free.mpc /minizinc/test.mzn /minizinc/2.dzn"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"PAR"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"docker run --rm <repository>:<tag> minizinc par.mpc /minizinc/test.mzn /minizinc/2.dzn"})})]})]})]}),"\n",(0,r.jsxs)(n.p,{children:["It is strongly recommended that you also test your submission using ",(0,r.jsx)(n.code,{children:"-v"})," and ensure that your\nMiniZinc library is being picked up correctly."]}),"\n",(0,r.jsx)(n.h3,{id:"uploading-your-submission",children:"Uploading your submission"}),"\n",(0,r.jsxs)(n.p,{children:["Once you have finalised your Docker image, you can push it to ",(0,r.jsx)(n.a,{href:"https://hub.docker.com",children:"Docker Hub"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"# If you did not include your username in the repository, you must add it with\ndocker tag <repository>:<tag> <username>/<name>:<tag>\n# Sign into Docker Hub\ndocker login\n# Upload the image\ndocker push <username>/<name>:<tag>\n"})}),"\n",(0,r.jsxs)(n.p,{children:["If you want to make your repository private then go to ",(0,r.jsx)(n.a,{href:"https://hub.docker.com",children:"Docker Hub"}),", sign\ninto your account, click on your repository, click on settings, and then on the button\n",(0,r.jsx)(n.code,{children:"Make Private"}),". You will have to give the Docker Hub user ",(0,r.jsx)(n.code,{children:"mznc"})," access to the repository in order\nto submit it."]}),"\n",(0,r.jsx)(n.p,{children:"You can then complete the web form (which will be made available to participants at the start of the\ninitial submission round) to 
1submit your entry."}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsxs)(n.p,{children:["Return to the ",(0,r.jsx)(n.a,{href:"/challenge/2022",children:"MiniZinc Challenge 2022"})," home page."]})]})}function u(e={}){return(0,r.jsx)(h,{...e,children:(0,r.jsx)(m,{...e})})}},57692:(e,n,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/challenge/2022/docker",function(){return i(50380)}])},91668:(e,n,i)=>{"use strict";i.d(n,{R:()=>t});var r=i(14232);let s=r.createContext({});function t(e){let n=r.useContext(s);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}}},e=>{e.O(0,[7725,8805,6701,4040,6958,636,6593,8792],()=>e(e.s=57692)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.