Comments (4)
docker run --user 1000:1000 -e ... mysql:8.4
I'm sorry.
I didn’t immediately see the solution and didn’t understand that the mysql user is assigned only if the container is started as a root user.
from mysql.
If the mounted directories (volumes) already have the correct owner/permissions for the user that you want to run mysql
as, then just run the container with that user id (and group id) and it will just work. The image is designed to run in this way.
docker run --user 1000:1000 -e ... mysql:8.4
The chown
and user swap are only done when running as root
(and indeed can only be done as root).
mysql/8.4/docker-entrypoint.sh
Lines 208 to 210 in c857c9c
mysql/8.4/docker-entrypoint.sh
Lines 375 to 377 in c857c9c
from mysql.
@yosifkit
volume is a universal storage to which several containers can connect, and therefore he should not depend on the settings of a specific container. Overriding the rights of a volume and its contents will disrupt the volume's interaction with other containers. If the volume and its contents are assigned to the same user and the containers communicate via the user ID(have access), the integrity of the interaction is maintained. If MYSQL supports the ability to interact with data through another user, then this possibility should be implemented in the Docker container. But you may not change anything and think that this is how it should be. At least my solution works for me.
Example: An nginx container and a php container can be configured in a way where data in a volume can be jointly managed through the user www-data(id82). Mysql container requires a special case, since they decided to hardcode 'mysql' user into the entry points. This is at least unprofessional.
from mysql.
https://hub.docker.com/_/mysql#:~:text=Running%20as%20an%20arbitrary%20user 😇
from mysql.
Related Issues (20)
- Issues with mysql:8.0.36-debian HOT 5
- null, message from server: "Host '172.18.0.1' is not allowed to connect to this MySQL server" in windows 11 HOT 1
- Docker issue HOT 1
- latest image has no connection HOT 13
- Single-quote character docker secrets causes failure in user creation HOT 2
- Not found docker image version 5.6.30 HOT 4
- mysql:oracle stopped working after recent pull HOT 6
- MySQL 8.4: 6125 (HY000) at line 1197: Failed to add the foreign key constraint. Missing unique key for constraint HOT 2
- Skip SSL HOT 4
- Container not working after building it HOT 3
- CPU does not support x86-64-v2 in the latest 8.4.0 HOT 11
- Environment broken (container restarting) in last version HOT 5
- Update Docker Image mysql 8.0.37 HOT 5
- Unable to start mysql with --mysql-native-password=ON HOT 5
- Docker character-set and collation-server problem after update HOT 3
- docker 8.4.0 swarm deploy start error: Data Dictionary initialization failed. HOT 6
- Client only variant? HOT 3
- internal users authentication plugin method HOT 2
- please add a mysql-router to the library package HOT 3
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.