CASSANDRA-20181: Update cqlsh Docker testing instructions to use public python:slim images on 4.0#4634
Open
arvindKandpal-ksolves wants to merge 4 commits intoapache:cassandra-4.0from
Conversation
Comment on lines
-17
to
-35
| There are Dockerfiles that can be used to test whether cqlsh works with a default, barebones | ||
| Python installation. Assuming Cassandra's source is checked out at `$CASSANDRA_DIR`. To test, first | ||
| build the Docker image containing the barebones Python installation - | ||
|
|
||
| $ docker build . --file Dockerfile.ubuntu.py3 -t ubuntu-lts-py3 | ||
|
|
||
| Next, run cqlsh inside the newly built image - | ||
|
|
||
| $ docker run -v $CASSANDRA_DIR:/code -it ubuntu-lts-py3:latest /code/bin/cqlsh host.docker.internal | ||
|
|
||
| If `host.docker.internal` isn't supported, then you can use `--net="host"` with `docker run`: | ||
|
|
||
| $ docker run --net="host" -v $CASSANDRA_DIR:/code -it ubuntu-lts-py3:latest /code/bin/cqlsh | ||
|
|
||
| This will try to spawn a cqlsh instance inside the Docker container running Ubuntu LTS (18.04) | ||
| with minimal Python installation. It will try to connect to the Cassandra instance running on the | ||
| Docker host at port 9042. If you have Cassandra running elsewhere, replace host.docker.internal | ||
| with the IP / hostname as usual. Please ensure that the IP / host is accessible from _within_ the | ||
| Docker container. No newline at end of file |
Member
There was a problem hiding this comment.
let's instead keep this, but use publicly available images…
(so it remains useful for folk who have docker but not python installed)
To run cqlsh using publicly available Docker images to connect to Cassandra on the same host, with `$CASSANDRA_DIR` pointing to either the source or install directory where `bin/cqlsh` is located.
For Python 3.8:
docker run -v $CASSANDRA_DIR:/code -it python:3.8-slim /code/bin/cqlsh host.docker.internal
For Python 3.11:
docker run -v $CASSANDRA_DIR:/code -it python:3.11-slim /code/bin/cqlsh host.docker.internal
If `host.docker.internal` isn't supported, then you can use `--net="host"`:
docker run --net="host" -v $CASSANDRA_DIR:/code -it python:3.8-slim /code/bin/cqlsh
This will spawn a cqlsh instance inside the Docker container. It will try to connect to the Cassandra instance running on the Docker host at port 9042. If you have Cassandra running elsewhere, replace host.docker.internal with the IP / hostname as usual.
updating the list^ for the python versions each cassandra branch actually supports (does 4.0 support 3.11 ?)
Contributor
Author
There was a problem hiding this comment.
I have try with the python 3.11 in docker ,it works :
used command :
docker run -v $CASSANDRA_DIR:/code -it python:3.11-slim sh -c "/code/bin/cqlsh host.docker.internal"
Contributor
Author
|
Thanks for review, @michaelsembwever ,😃 |
…m images Incorporated reviewer feedback to replace custom Ubuntu Dockerfiles with publicly available python:slim images. Explicitly tested and documented supported Python versions (2.7 to 3.11) for the 4.0 branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / Why we need it:
This PR updates the
pylib/README.ascto replace the custom Ubuntu Dockerfiles with publicly availablepython:X.Y-slimimages for testingcqlsh. This addresses the reviewer's feedback, making it easier and more accessible for users who have Docker but not Python installed locally, without needing to build custom images.Changes:
docker runcommands usingpython:slim.--net="host"fallback command for Linux users wherehost.docker.internalis not supported.patch by Arvind Kandpal; for CASSANDRA-20181