This repo builds the image used for Simsopt Dev Container.
The image can be built locally
-
Install docker
-
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
-
Upload the image to docker hub if you want to distribute it
docker push <image_name:tag>
There are two cases here: 1) docker image is built locally and 2) docker image downloaded from a repo
- Identify the local image using the command
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
docker image ls
-
Assuming image is uploaded to docker hub, use the <user_name/image_name:tag> to automatically download the image in the next command
-
For interactive runs, run the docker container with the command:
docker run -it --rm <image>
-
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