Comments (31)
@mnagy I thought we already have socket enabled and that is the way you connect to mysql when docker exec. If not, then it is a bug.
from mysql-container.
+1 for making the command line arguments voluntary (if that was what enabling unix socket means in eventually)
About the "mysql" wrapper -- I don't see any other solution to enable this, so +1 as well. It's not nice though that this wrapper may conflict with the system binary (provided by non-SCL mariadb package).
from mysql-container.
@hhorak it is possible to make mysql consume parameters as env variables? so you don't have to set them?
from mysql-container.
It seems like it should be possible: https://dev.mysql.com/doc/refman/5.5/en/environment-variables.html
from mysql-container.
@mnagy before going to create bash script, please explore if we can do it 'clean' way without wrappers.
from mysql-container.
@mfojtik enabling the socket seems a better solution than working with env vars (and very easy one at that) wrt to wrapper script, we already determined that this can't be done in any other way, remember @hhorak's matrix?
@hhorak I'll try to figure out a path that won't collide, but this should not be a concern since we'll be pretty sure MariaDB packages won't be installed.
from mysql-container.
@mfojtik there are no environment variables for user and dbname afaict (didn't find any at least), but to avoid passing parameters there is $HOME/.my.cnf that should have correct permissions.
from mysql-container.
OK, I misunderstood this... I thought this is a bug where when you enter the container namespace and execute 'mysql' you will not be connected to mysql as admin user.... now I understand what @mnagy is trying to solve here... docker exec 123456 mysql
where the mysql is a wrapper bash script... I don't like that solution... we should stop providing wrappers for stuff like this. This should be fixed in SCL collection and provided by the SCL mysql package, not by this hacky workaround.
from mysql-container.
@hhorak @mnagy also the solution here is to execute this command:
docker exec 123456 /bin/sh -c mysql
@hhorak also you should talk to Docker folks about providing some hook mechanism to inject your SCL vars/scl enable before we enter the running container.
from mysql-container.
@mfojtik SCL packages can't provide such a wrapper. If they could, they could just install the binary directly into $PATH. I don't know about patching docker, it's questionable if they'd want to provide a hook mechanism, although that would help things.
And yes, running /bin/bash -c mysql
(/bin/sh
won't) might do the trick, but it seems to me too verbose if you can simplify it and only need mysql
. Reason why I think we should do it is that for other images (those not using SCL), running mysql
will work out of box. I'm afraid that users will be confused when it won't work for our images.
from mysql-container.
@mnagy I think /bin/bash -c mysql
is reasonable and we can document that. Having to ship extra wrapper with the same name as the RPM binary is too hackish to me.
from mysql-container.
@mfojtik well, tested it and /bin/bash -c mysql
does not work. You need to execute bash and then execute mysql. Adding -l
to bash won't make it work as well.
from mysql-container.
@mfojtik as @mnagy said, shipping the wrapper in the RPM is no go, it is actually against SCL concept to not influence the base system. The wrappers were consulted already before and they were explicitly denied by PM. Although you're right about the request to the Docker folks, I will at least try to do something about it.
from mysql-container.
@mnagy that command should work, if not we should fix it. It seems like the .bashrc file is not picked up and the collection is not enabled properly.
from mysql-container.
@hhorak @mnagy if SCL don't want wrappers, why should we go against that?
from mysql-container.
Could the discussed 'docker exec cont-entry mysql' help here?
from mysql-container.
Ouch, sorry, it was changed to container-entrypoint
example:
https://github.com/sclorg/rhscl-dockerfiles/blob/master/rhel6.postgresql92/usr/share/cont-docs/70-general.txt
from mysql-container.
@praiskup @hhorak I thought we all agree that this should work out-of-box without having middle-man script (looking at the matrix from May/11).
from mysql-container.
@mfojtik There is one case that doesn't work (#6 in the matrix from May/11) -- non-bash binary run as docker exec
, which is exactly the case with docker exec -ti mysql
. That's why @mnagy suggested the wrapper.
from mysql-container.
@hhorak but docker exec $CID /bin/bash -c "mysql"
should work according to matrix, or I'm wrong?
from mysql-container.
@mfojtik not implemented in our images.
from mysql-container.
@mnagy what you mean 'not implemented' in our images? i thought that is the reason why we have $HOME/.bashrc and bash reads it when it starts.
from mysql-container.
@mfojtik it only works for bash
. For bash -l
you need something in /etc/profile
and for other uses (bash -c
, executing a bash script) you need to set BASH_ENV
.
from mysql-container.
@mnagy can you make a PR to set BASH_ENV for our images? and test it.
from mysql-container.
@mfojtik just BASH_ENV? What about /etc/profile.d/?
from mysql-container.
@mnagy @mfojtik I also don't like the wrapper script approach, it was a problem in v2 because no one understood that we'd supplanted the normal binary with an alias(we used an alias in v2 for a similar use case) and there were subtle differences in behavior that confused people who thought they were running the normal binary but were actually getting the wrapper alias.
from mysql-container.
@bparees +100 I thought we can do much better in Docker than in v2
from mysql-container.
@bparees bash wrapper script is not the same as binary. And the /opt/rh/.. path set by scl enable precedes ordinary $PATH. This means that if you're in a (scl enabled) bash session, running mysql will execute the correct binary. The wrapper would only be executed in a non-enabled bash session (bash -l unless we chose to add .bashrc also to /etc/profile/) or during docker/oc exec.
from mysql-container.
I meant, not the same as an alias.
from mysql-container.
@mnagy I don't see docker exec CID /bin/bash -c mysql
as a big problem. At least we are not hiding that we actually execute a bash to enable SCL and we make it explicit for users. Having two executables named "mysql" will be confusing for users and it cripple the PATH when executing it the way you propose.
from mysql-container.
@mnagy it's the same in that it's magic a user is unware of that has unpredictable behavior if you think you're running the binary.
from mysql-container.
Related Issues (20)
- Is this image production ready with persistent storage? HOT 4
- How to initialize mysql container when created on openshift 3.11? HOT 2
- Logs files are not available HOT 1
- Openshift Pod logs print "Got an error reading communication packets" HOT 3
- SQL Error (1030): Got error 122 from storage engine
- [ERROR] InnoDB: Failed to create check sector file, errno:28 Please confirm O_DIRECT is supported and remove the file ./check_sector_size if it exists.
- How to upgrade from mysql5.7.24 to 5.7.28 HOT 1
- Create a check script for testing database
- mysql cluster image HOT 1
- Is it possible to create more than one database when init container? HOT 2
- centos/mysql-57-centos7:latest - CentOS Root access? HOT 1
- How to set --memory as image parameter?
- where should put my .sql files
- OpenShift failures
- Testing issue created for samples operator HOT 1
- Testing issue creation for samples operator HOT 1
- Fail to deploy on OKD4 - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) HOT 1
- No Action Required !! Testing automation workflow HOT 1
- No Action Required !! Testing automation workflow HOT 1
- Unable to change root password for the persistent storage implementation in OpenShift HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql-container.