Skip to content

User_Docker

Adrien Pavão edited this page Aug 16, 2023 · 19 revisions

CodaLab always runs submissions inside Docker environments. This page is a cheat sheet for users (participants or organizers) who want to run their code in their own docker. If you are an organizer, you can specify your new docker as a competition property in the competition YAML file or the editor.

Imagine that you want to change/modify the version of Python Codalab competition used by default codalab/default, which points right now to docker-codalab-legacy-worker a.k.a. codalab/codalab-legacy.

Interactive modification

One way to modify the default docker is to:

  1. Install docker. Create a repo e.g. myrepo/codalab
  2. At the prompt, type: docker run -itd -u root codalab/codalab-legacy:py37 /bin/bash
  3. Use docker ps to find running container id.
  4. Now run docker exec -it -u root 78e82f680994 bash
  5. The prompt will look like root@78e82f680994$, make a note of the container ID e.g. 78e82f680994.
  6. Install anything you want at the docker container shell
  7. Exit the shell with exit
  8. docker commit 78e82f680994 myrepo/codalab:legacy (replace legacy by another name or a version number)
  9. docker login
  10. docker push myrepo/codalab:legacy

Dockerfile

Another way to modify the default docker is to:

  1. Install docker. Create a repo e.g. myrepo/codalab
  2. Folk or download docker-codalab-legacy-worker from Github.
  3. Put the docker image in a new directory and modify Dockerfile:
mkdir codalab
cp /path/to/docker-codalab-legacy-worker/Dockerfile codalab/Dockerfile
cd codalab 
vim Dockerfile
  1. Build docker: docker build -t myrepo/codalab:legacy . Be sure to run the docker build command from within the directory that contains the Dockerfile.

  2. Push your image to the repo: docker push myrepo/codalab:legacy

Setup your own Docker image in your competition

Once your Docker image is ready, you can set it up in your competition, either by:

  • Specify the Docker Hub ID of your image inside the competition.yaml file before uploading your bundle:
competition_docker_image: myrepo/codalab:legacy
  • Use the "EDIT" menu of your already created competition, and put the Docker Hub ID of your image in the following field: competition_docker_image_field

Default docker image

If no docker image is specified, submissions are run in codalab/codalab-legacy:py37, the default docker, which can be found on Github.
2022 Warning: the default docker has been updated, old competitions may be affected.

Clone this wiki locally