This article is part of a series on using Docker for CLI tools. You can read the original article here.
Oracle SQL*Plus is the Command Line (CLI) tool to connect to Oracle. It is part of the Oracle Instant Client set of tools. I’ve always found the installation process to be cumbersome as it requires a few steps (not a straight install or base executable like SQLcl).
Oracle has made the Instant Client files now available on a pre-built Docker image. This article covers how to download the Docker image and use it to run SQl*Plus in a container rather than a local install.
Oracle has its own container registry. Before using any of their pre-built images you must accept the license agreements (this only has to be done once).
- Go to container registry
- Search for
instantclient(all one word)
- Select the
- Select the
- Sign In (image below) and accept the license agreements
In your terminal run:
docker login container-registry.oracle.com
You will be required to enter in your Oracle SSO login credentials (only need to do this once).
~/.zshrc add the following alias
alias sqlplus='docker run -it --rm \
Start a new terminal (so the alias is registered) and just run
sqlplus as you normally would.
The current image from Oracle is using Instant Client
22.214.171.124.0 where as at the time of writing the most current version is
126.96.36.199.0. If you want to build your own image so you can run the latest version, you can use Oracle’s Docker Image files (just search for the version you want).