7
How to build and test a Docker container for your ICCMA19 solver Install and run Docker This document is a step-to-step guide for packaging your solver to be submitted to International Competition on Computational Models of Argumentation (ICCMA 2019) into a Docker container. First, create a Docker Cloud account here: https://cloud.docker.com In the following of this manual we consider as DOCKER_ID the name iccma19. Then, sign in and 1. Click on “Create Repository”. 2. Choose a name for the Docker repository of your solver (e.g., “YOUR_SOLVER_REPOSITORY”) and a description for your repository, select “public”, and then click on “Create”. In the following, we suppose the chosen solver name is conarg. See Figure 1. Figure 1: create the repository for your solver.

How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

HowtobuildandtestaDockercontainerforyourICCMA19solver

InstallandrunDockerThisdocumentisastep-to-stepguideforpackagingyoursolvertobesubmittedtoInternationalCompetitiononComputationalModelsofArgumentation(ICCMA2019)intoaDockercontainer.First,createaDockerCloudaccounthere:https://cloud.docker.comInthefollowingofthismanualweconsiderasDOCKER_IDthenameiccma19.Then,signinand

1. Clickon“CreateRepository”.

2. ChooseanamefortheDockerrepositoryofyoursolver(e.g.,“YOUR_SOLVER_REPOSITORY”)and a description for your repository, select “public”, and then click on “Create”. In thefollowing,wesupposethechosensolvernameisconarg.SeeFigure1.

Figure1:createtherepositoryforyoursolver.

Page 2: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

YourrepositoriescanalsobeaccessedbysigninginonDockerHub:https://hub.docker.com/(sameloginnameandpassword).SeeFigure2.

Figure2:containerviewfromhttps://hub.docker.com.

Then,installDockeronyourmachine.PleaserefertotheofficialinstallationWebpage:https://docs.docker.com/install/.Forinstance:Linux:https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce orhttps://linuxize.com/post/how-to-install-and-use-docker-on-ubuntu-18-04/(forUbuntu18.4)Windows:https://docs.docker.com/docker-for-windows/install/Mac:https://docs.docker.com/docker-for-mac/install/Onceaccomplished,openaterminalwindowonyourmachineandbesuretheDockerdemonisrunning.Forexample,runthehello-worldcontainer(notthattheallthefollowingdockercommandsmayneedtoberunwithsudobeforethem):dockerrunhello-worldThenfromterminallogintoyourDockeraccountbytyping:dockerlogin--username=DOCKER_ID

WhereDOCKER_IDisthenameofyourDockeraccount(iccma19inthisrunningexample).YouwillbealsorequiredtotypeyourDockerpassword.Thefollowingscreenshotshowsthiscommandintheterminal.

Page 3: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

SolverDockerizationIn this section we describe how to create a Docker container with your solver. First, create adirectory“SOLVER_DIR”,somewhereonyourmachine.Thisdirectoryneedstocontainatleast:

1. Allthefilesneededbyyoursolver;weuse“YOUR_SOLVER”asthenameofthesolvermainexecutable.

2. The runsolver tool used to monitor the execution of your solver (seehttp://www.pragmaticsofsat.org/2011/presentations/slides-or.pdf).

3. A“wrapper.sh”shellscript,whichwilluserunsolverandcallthescriptatbullet4.4. A“generic-interface-2019.sh”shellscript,whichneedstobeadaptedinordertoimplement

the required input/output interface (for more details please check the document athttp://iccma19.dmi.unipg.it/res/SolverRequirements.pdf).Ifyoursolvernativelyimplementssuchaninterface,thescriptatbullet3hastodirectlycallyoursolverandnotthisscript.

5. A file named “Dockerfile” (requiring Alpine Linux for running the solver, and definingwrapper.sh,bullet3,astheentry-pointofexecution).

WhenyoubuildanimagebyusingthisDockerfile,theassembledpackagewillcontainaminimaldistributionof Linux (Alpine Linux: https://alpinelinux.org), andall the files at bullets 1-5. If thesolveriscomposedbyseveralexecutables/files,addallofthemtothisdirectory.PleasetrytouseAlpine Linux: if you use a different Linux distribution, e.g., Ubuntu, the final image size willconsiderablyincrease(from~10to~80GB).Thefollowingscreenshotshowstheminimalcontentofthe“SOLVER_DIR”directory(conarg_dir inthisexample).Asrunningexample,wewillbuildacontainerforconarg,whichrepresentsaninstantiationofthe“YOUR_SOLVER”stringinthisguide.

Then,besuretobeinside“SOLVER_DIR”,andtype

dockerbuild-tDOCKER_ID/YOUR_SOLVER_REPOSITORY.whereYOUR_SOLVER_REPOSITORYisthenameoftherepositoryyouhavecreatedinthisprevioussection,and“.”(oralternatively“./”)isthecurrentfolderthatcontainsallthefiles.Inthisexample,DOCKER_ID/YOUR_SOLVER_REPOSITORYwillthencorrespondtoiccma19/conarg.This command builds aDocker image containing everything is inside the current directory. ThefollowingscreenshotshowswhathappenswhenthiscommandisexecutedtobuildanimageoftheConArgsolver.

Page 4: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

Afterwards, check if the image "DOCKERID/YOUR_SOLVER_REPOSITORY" has been successfullycreated(theresultforthisrunningexampleisshowninthefollowingscreenshot.dockerimages

Inordertotestifyourdockerizedsolverworksfine,youfirstneedasecondcontainerstoringsometest-frameworks from ICCMA 2017. The container iccma19/test_frameworks stores twoframeworks:admbuster_1000.apxandadmbuster_1000.tgf.Pleasetypethefollowingcommandsoneaftertheother(respectivelyretrievingfromarepositoryandthenrunningthissecondcontainer):dockerpulliccma19/test_frameworks dockerrun-d--nametest_frameworksiccma19/test_frameworksThese commands pull a new container and run it in background (-d option), with nametest_frameworks.Now it is possible to launch your dockerized solver on one of the framework instances intest_frameworks;use,forinstance,thecommand

Page 5: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

dockerrun--volumes-fromtest_frameworksDOCKER_ID/YOUR_SOLVER_REPOSITORY600-f/test_frameworks/admbuster_1000.apx-foapx-pDC-PR-ac408to check the credulous acceptance of argument c408 with the preferred semantics on fileadmbuster_1000.apx. The first parameter after DOCKER_ID/YOUR_SOLVER_REPOSITORY hasalways to be the timeout in seconds (600 seconds in this example). The result is shown in thefollowingscreenshot.

Afterthetimeoutinseconds,yoursolvercanbeexecutedbyusingasupersetoftheoptionsusedinICCMA2017(adding–mistheonlychange):

• -ffileinput(thefilestoringtheframework)• -mfileinput(thefilestoringthemodificationonthefilepassedwith–f,usedinthedynamic

trackonly)• -foformat(apxortgf)• -pproblem(EE-PR,DS-PR,etc.)• -aadditional(e.g.,argumenttobecheckedforcredulous/skepticalacceptance)

Please refer to http://iccma19.dmi.unipg.it/SolverRequirements.pdf for detailed information oncomments. The iccma19/test_frameworks image also contains two modification files(admbuster_1000.apxmandadmbuster_1000.tgfm),inordertotestalsodynamicsolvers.Finally,youcanpushtheimagetoyourpersonalrepository:dockerpushDOCKER_ID/YOUR_SOLVER_REPOSITORYTheresultisinthefollowingscreenshot:

TherepositoryhasbeennowupdatedalsoonDockerHubhttps://hub.docker.com/,asFigure3shows.

Page 6: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

Figure3:anewpullforthisrepository.

Topullitagainfromyourrepository,firstlogin(e.g.,dockerlogin--username=iccma19),andthenusethecommanddockerpullDOCKER_ID/YOUR_SOLVER_REPOSITORY

A link to a public repository, as iccma19/conarg in this example, is what theparticipants need to clearly state in their solver description (submitted throughEasyChair),andrepresentsmandatoryinformationforasolversubmission.Allthefilesusedinthisguidetodockerizeconarg(i.e.,conarg_dir)canbefoundatthefollowinglink:

• http://iccma19.dmi.unipg.it/add/conarg_dir.zipThesamplefilesusedtocreatetest_frameworkscanbefoundat:

• http://iccma19.dmi.unipg.it/add/code/test_frameworks.zip

Furthercommands

Wenowreportacoupleofusefuladditionalcommandsyoumightusetoassembleyourcontainer.Incaseofanyproblem,pleaserefertotheofficialdocumentation:

Page 7: How to build and test a Docker container for your ICCMA19 ... · The first one can be used to locally remove a Docker image (fbff44780fae is the image ID you can obtain with the docker

https://docs.docker.com/engine/reference/commandline/docker/#child-commandsThefirstonecanbeusedtolocallyremoveaDockerimage(fbff44780faeistheimageIDyoucanobtainwiththedockerimagescommand,-fisaforceflag):dockerrmi-ffbff44780faeInordertolistallthecontainersrunningonyourmachine,type:dockerpsOrdockerps–atogetallthecontainers(alsostoppedones).Toremoveoneofsuchcontainers,thecommandis(3355386d91cbisthecontainerIDyoucanobtainwiththedockerpscommand):dockerrm3355386d91cbFinally,tostoptheexecutionofthecontainerwithID3355386d91cb:dockerstop3355386d91cb