Update Dockerfile and its README
The original Dockerfile has issues and is not working. Ubuntu and Python versions are not specified, and the link to Psi4 is expired. This pull request fixes the Dockerfile and updates its README.md to match.
The new configuration has been tested on an Apple Silicon Mac (M4). Customization for other platforms is straightforward and can be understood easily with the updated README.md.
Changes to Dockerfile:
- Pin versions for Ubuntu (22.04) and Python (3.12).
- Add
WORKDIRto mount local files. - Set
PATHwithENV. - Psi4 is installed with a conda command instead of
wget. - Dependencies are installed inside of a virtual environment (
fermion). - Reduce the number of
RUNcommands to reduce the number of layers.
Changes to its README.md:
- Put some details on the Dockerfile in the first paragraph of Setting up ~.
- Add details to customization.
- Change
docker runcommand and introduce a simpler way to mount local files. So some previous explanations are deleted.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
@Bevacizumab Thank you for this contribution! It looks like Google's bots don't have a record of an agreement to the contributor's license agreement (CLA), so please follow the instructions in the CLA bot comment earlier. (It's simple and doesn't require giving away any rights.)
@mhucka Thank you for checking this pull request.
I completed the CLA last week, right after I saw the bot's comment. I've just confirmed that the CLA status is green in the "Checks" tab. It seems you might have been viewing an older notification without refreshing it.
Please let me know if you have any feedback on the code changes themselves. Thank you!
I completed the CLA last week, right after I saw the bot's comment. I've just confirmed that the CLA status is green in the "Checks" tab. It seems you might have been viewing an older notification without refreshing it.
Oh, great. Thanks for doing that.
Please let me know if you have any feedback on the code changes themselves. Thank you!
Yes, I will review it.
@Bevacizumab Thanks again for your work. There is a problem, but it may be easy to fix.
The Anaconda terms of service requires a license for business organizations. Specifically, under section 1.b of https://www.anaconda.com/legal/terms/terms-of-service (dated 2025-07-25):
When a Business Plan is Required. You must pay for a ‘Business Plan’ Subscription from Anaconda if you are using the Platform on behalf of a for-profit organization with more than 200 total employees or contractors (including all Affiliates) and you do not qualify for free use under Section 1(a) of these Terms (When Your Use is Free).
So, OpenFermion can't use make use of conda, miniconda, or the packages from https://repo.anaconda.com/pkgs/.
However, we can use conda-forge and miniforge. Would it be possible to rewrite your Dockerfile to use the miniforge3 installer and the conda-forge channel?
@mhucka Thank you for detailing the issue and introducing me an alternative approach. I wasn't aware of the issue with conda for this project.
However, we can use conda-forge and miniforge. Would it be possible to rewrite your Dockerfile to use the miniforge3 installer and the conda-forge channel?
I will try to update dockerfile with conda-forge and miniforge.
Additionally, i'm planning to pin the versions of the installed five packages (openfermion, cirq, openfermioncirq, openfermionpsi4, and openfermionpyscf) to ensure the reproducibility of dockerfile. Also, I will update README for indicating one can manually change the package versions.
Due to my current schedule, I may not be able to make the changes immediately, but I expect to have it done within the next few weeks (hopefully sooner).
There is a question about the versions of ubuntu and python for this project. I have tentatively used ubuntu 22.04 and python 3.12 because FROM ubuntu and RUN apt-get install -y python3 in the original dockerfile automatically installs ubuntu 22.04 and python 3.12 in my machine. Let me know if there any preferred versions to ubuntu and python for this project. If there are no specific preferences, I will proceed with ubuntu 22.04 and python 3.12.
Hello @mhucka. Thank you for your patience over the last few weeks. I'm glad to let you know that I've updated the dockerfile to use Miniforge3 and conda-forge channel. I chose not to pin the versions of the installed packages because of the complicated dependency issues this can cause.
The latest changes have been pushed to this pull request. Could you please take a look when you have a moment?
Hi @mhucka, I've just rebased my branch on top of the latest master. Sorry for the long wait.
@Bevacizumab Thank you for your continued efforts on this. I've added some review comments.
I will also do a PR to update the .hadolint.yaml configuration to avoid one of the Dockerfile errors it flagged because IMHO it's more of an annoyance than a benefit.
@mhucka Thank you for your good and detailed review comments. It helped me a lot for improving the Dockerfile. I will explain the changes in the commit.
Dockerfile
USER rootis deleted.- I put
--no-install-recommendsflag forapt-get install. - I thank you for adding the configuration setting.
- I fixed the package versions for
apt-get install. Unfortunately, it requires the full strings. I've manually checked all the installed packages' versions for both arm64 and amd64 architectures. Both architectures install the same version for each package. - I've made changes to support both linux/arm64 and linux/amd64 architectures (Psi4 only supports these two linux architectures). It is possible by putting
unameanduname -mfor the wget link of Miniforge. - Additionally, I solved DL3003 warning. Each
cdwas changed toWORKDIR.
README
- I added information about the architecture support to help anyone who is not familiar with the concept.
- I corrected the typo
environemnt. - I deleted the explanation of "the default architecture".
- I reverted to CLI-based instructions. Mounting local files is a good docker practice. But some might not want to do this. So I provide instructions on how to
COPYor not, and how to mount or not. I split the explanation of copying local files and git repositories into a new subsection for clearance.