You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docker/README.md
+22-23Lines changed: 22 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,24 +27,12 @@ OpenFermion (or any of its plugins) using the standard procedure.
27
27
28
28
29
29
## Setting up Docker for the first time
30
-
31
30
The Dockerfile is based on the [Ubuntu image](https://hub.docker.com/_/ubuntu) (ver. 22.04).
32
-
It creates a Python (ver. 3.12) virtual environemnt (named `fermion`) using Miniforge and installs all dependencies within it. Psi4 is installed with a conda [command](https://psicode.org/installs/v191/).
33
-
The default configuration uses the latest Miniforge installer on Linux `aarch64` architecture.
31
+
Two Linux architectures are supported in the Dockerfile: x86_64 (amd64) and aarch64 (arm64).
32
+
Detecting your host's architecture is handled automatically through the following docker image building process, so you don't have to check it manually.
33
+
It creates a Python (ver. 3.12) virtual environment (named `fermion`) using Miniforge and installs all dependencies within it. Psi4 is installed with a [conda command](https://psicode.org/installs/v191/).
34
34
35
-
### Customizing the Environment
36
-
You can manually edit the Dockerfile if you need to set up a different development environment (e.g., changing the Ubuntu, Python, Miniforge, or Psi4 version).
37
-
38
-
If your local machine builds Linux `x86_64` architecture with the Dockerfile, the `wget` command
39
-
for the Miniforge installer (Line 40 in the Dockerfile)
You can check other Miniforge installers [here](https://github.com/conda-forge/miniforge?tab=readme-ov-file#requirements-and-installers).
35
+
You can manually edit the Dockerfile if you need to set up a different development environment (e.g., changing the versions of Ubuntu, Python, Miniforge, Psi4, etc.).
48
36
49
37
### Building Docker Image
50
38
You first need to install [Docker](https://www.docker.com/).
@@ -54,27 +42,38 @@ Dockerfile for building the OpenFermion image (/docker/dockerfile) and run
54
42
```
55
43
docker build -t openfermion_docker .
56
44
```
57
-
58
45
where "openfermion_docker" is just an arbitrary name for our docker image.
59
46
Building the Dockerfile starts from a base image of Ubuntu and then installs
60
47
OpenFermion, its plugins, and the necessary applications needed for running these
61
48
programs. This is a fairly involved setup and will take some time
62
-
(perhaps up to thirty minutes depending on the computer) and disk space (several gigabytes).
49
+
(perhaps up to thirty minutes, depending on the computer) and disk space (several gigabytes).
50
+
51
+
Line 18 in the Dockerfile
52
+
```
53
+
COPY . /root/workspace
54
+
```
55
+
copy the files in the current local directory (where the Dockerfile is located) when the image is built.
56
+
If you don't want to copy the files, delete the line first and then build the image.
63
57
64
58
### Running the Container
65
59
Once the image has been built, run the image with
66
60
```
67
61
docker run -it --name openfermion_container -v $(pwd):/root/workspace openfermion_docker
68
62
```
69
-
where "openfermion_container" is an arbitrary choice for the name of our docker container. This command will mount your current local directory to `/root/workspace` inside the running container.
63
+
where "openfermion_container" is an arbitrary choice for the name of our docker container. This command will mount your current local directory, where the Dockerfile is located, to `/root/workspace` inside the running container.
70
64
By default, the virtual environment `fermion` is automatically activated in the running container.
71
-
After installing the `Dev Containers` extension in Visual Studio Code,
72
-
you can open the container with the following option:
65
+
66
+
If you don't want to mount the current directory, run the following command instead:
73
67
```
74
-
Command Palette -> Dev Containers: Attach to Running Container..
68
+
docker run -it --name openfermion_container openfermion_docker
75
69
```
76
-
and select `openfermion_container` for this example.
77
70
71
+
### Copy Local Files into the Container
72
+
Line 18 in the Dockerfile (`COPY . /root/workspace`) copies the current files only once when the image is built.
73
+
Local files in any directories can be copied using:
74
+
```
75
+
docker cp [path to file on disk] [container name]:[path in container]
76
+
```
78
77
An alternative way of loading files onto the Docker container is through
79
78
remote repos such as GitHub. Git is installed in the Docker image.
80
79
After `docker run`, one could run "git clone ..." etc to pull files
0 commit comments