Skip to content

Conversation

@mhucka
Copy link
Member

@mhucka mhucka commented Dec 27, 2025

This adds a new subdirectory release/docker/ that contains a Dockerfile and a script to create Docker images. These are useful for testing TensorFlow Quantum builds in more isolated environments with different versions of Python. The setup is not fancy, but it is useful when (e.g.) trying different combinations of dependencies with different Python versions.

Running the script create_docker_images.sh in that directory creates a total of eight images, with names like ubuntu22-cp310, ubuntu22-cp311, etc. The images are based on Ubuntu Linux 22.04 and 24.04, with the addition of Python preinstalled and very little else.

More information can be found in the README file release/docker/README.md.

Installing those can hide the problem that these are not available in
newer Python versions, giving a false sense of security to a developer.
Changes:

* Add support for a verbose flag and a help flag
* Use a better way to list the images built by this script
@mhucka mhucka marked this pull request as ready for review December 27, 2025 23:59
For some reason, the previous approach of apt-installing
software-properties-common and then doing `add-apt-repository -y
ppa:deadsnakes/ppa` started failing for me locally. I suspect some new
security measure on Google dev systems. Switching to an approach of
getting the deadsnakes list directly works better.
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could probably shorten things a bit with all the env vars etc, only major concern is what's happening with the install of python3-pip and the interaction with update-alternatives there.

Per review comments by Michael Broughton, the pip installed by the
python3-pip package may not be the one that scripts and commands get
after python3 is changed using update-alternatives. It is safer to
install pip explicitly ourselves using the `get-pip` script.
The `apt clean` resulted in a warning during Docker builds. The use of
`apt` here was an oversight -- the other places in the Dockerfile used
`apt-get` already.
Revises the pip installation procedure to avoid the use of the
`python3-pip` package.
@mhucka
Copy link
Member Author

mhucka commented Jan 27, 2026

@MichaelBroughton This has the changes discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants