Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.51 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.51 KB

Simsopt Dev Container

This repo builds the image used for Simsopt Dev Container.

Build the image

The image can be built locally

  1. Install docker

  2. Build the docker image by running the docker build command:

    docker build -t <[user_name/]image_name:[tag]> -f Dockerfile.ubuntu .
    # In the above command, user_name is typically used for uploading the image to docker hub
    # For local builds, you can omit the user_name/ and just use your choice of image_name
    # Tag is optional. If not given, default is latest
  3. Upload the image to docker hub if you want to distribute it

    docker push <image_name:tag>

Run the container

There are two cases here: 1) docker image is built locally and 2) docker image downloaded from a repo

For local builds:

  1. Identify the local image using the command
     docker image ls
    After identifying the image built locally, you can use either <image_name:tag> or the image id, which is an hexadecimal number, to run the docker image in the next command

Remote repo

  1. Assuming image is uploaded to docker hub, use the <user_name/image_name:tag> to automatically download the image in the next command

  2. For interactive runs, run the docker container with the command:

    docker run -it --rm  <image>
  3. To execute a python script

    docker run -v$PWD:$PWD <image> python3 $PWD/<python_script>

    This command works only if no additional files are needed to run the script