MySQL Shell images, use it from container's cli or extend it to build your service image.
68
Deploy a container and open mysqlsh, remove the container when stopped:
docker run --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c mysqlsh
Deploy a container and connect to a databases, remove the container when stopped:
docker run --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c "mysqlsh user@host:port/schema"
Deploy a container and connect to a database execute a query and remove the container:
docker run --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c "echo \"query\" | mysqlsh --sql --uri=user@host:port/schema"
Deploy a container setting the WORKING DIRECTORY (-w), binding it with a host location (-v), and after the export is done remove the container:
docker run -v ${PWD}/json:/host_dir -w /host_dir --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c "echo \"query\" | mysqlsh --sql --result-format=json/array --uri=user@host:port/schema > export.json"
Deploy a container setting the WORKING DIRECTORY (-w) pointing to the bonded volume (-v) where the host contains the SQL file (mysqls.sql). After the execution removes the container:
docker run -v ${PWD}:/host_sqls -w /host_sqls --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c "echo \"$(cat mysqls.sql)\" | mysqlsh --sql --uri=user@host:port/schema"
Deploy a container setting the WORKING DIRECTORY (-w) pointing to the bonded volume (-v) where the host contains the script file (myscript.sh). After the execution removes the container:
docker run -v ${PWD}:/host_scripts -w /host_scripts --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c "sh myscript.sh"
...
These are only some examples but a lot more can be done.
Content type
Image
Digest
Size
67.1 MB
Last updated
over 5 years ago
docker pull andreadipietro/mysql-shell:8.0.25_debian-buster-slim