-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Cannot run container with random --user (5.7) #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure what you're doing to create As for just running the existing image with an arbitrary UID, that's already supported (since #161), as long as the $ docker pull mysql:5.7
5.7: Pulling from library/mysql
Digest: sha256:f030e84582d939d313fe2ef469b5c65ffd0f7dff3b4b98e6ec9ae2dccd83dcdf
Status: Image is up to date for mysql:5.7
$ mkdir temp
$ sudo chown 1234:1234 temp
$ ls -ld temp
drwxr-xr-x 2 1234 1234 4096 May 18 10:12 temp
$ docker run -it --rm -e MYSQL_ROOT_PASSWORD=foobar --user 1234:1234 -v "$PWD/temp":/var/lib/mysql mysql:5.7
Initializing database
2018-05-18T17:13:30.482249Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-18T17:13:30.796840Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-18T17:13:30.840598Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-18T17:13:30.901800Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c9b2b283-5abe-11e8-8ac5-0242ac12001a.
2018-05-18T17:13:30.903698Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-18T17:13:30.905034Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2018-05-18T17:13:31.521929Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.521977Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.521994Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.522022Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.522033Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.522052Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.522119Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:31.522139Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
Database initialized
Initializing certificates
Generating a 2048 bit RSA private key
.................................+++
..............................+++
unable to write 'random state'
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
.................+++
.......................................+++
unable to write 'random state'
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
...................................+++
...........+++
unable to write 'random state'
writing new private key to 'client-key.pem'
-----
Certificates initialized
MySQL init process in progress...
2018-05-18T17:13:33.833603Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-18T17:13:33.834407Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 75 ...
2018-05-18T17:13:33.836048Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-05-18T17:13:33.836059Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-18T17:13:33.836061Z 0 [Note] InnoDB: Uses event mutexes
2018-05-18T17:13:33.836064Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-18T17:13:33.836065Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-18T17:13:33.836067Z 0 [Note] InnoDB: Using Linux native AIO
2018-05-18T17:13:33.836184Z 0 [Note] InnoDB: Number of pools: 1
2018-05-18T17:13:33.836236Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-18T17:13:33.837104Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-18T17:13:33.840782Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-18T17:13:33.841859Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-05-18T17:13:33.852849Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-18T17:13:33.861872Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-18T17:13:33.861969Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-18T17:13:33.893591Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-18T17:13:33.894120Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-18T17:13:33.894130Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-18T17:13:33.894688Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 2589156
2018-05-18T17:13:33.894984Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-05-18T17:13:33.895251Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-05-18T17:13:33.895871Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180518 17:13:33
2018-05-18T17:13:33.898195Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-05-18T17:13:33.898373Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-18T17:13:33.901596Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-05-18T17:13:33.902121Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902134Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902140Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902149Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902152Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902158Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902800Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.902808Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:33.905933Z 0 [Note] Event Scheduler: Loaded 0 events
2018-05-18T17:13:33.906096Z 0 [Note] mysqld: ready for connections.
Version: '5.7.22' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL)
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2018-05-18T17:13:35.662845Z 4 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662861Z 4 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662869Z 4 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662882Z 4 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662886Z 4 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662895Z 4 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662926Z 4 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.662931Z 4 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:35.664005Z 0 [Note] Giving 0 client threads a chance to die gracefully
2018-05-18T17:13:35.664015Z 0 [Note] Shutting down slave threads
2018-05-18T17:13:35.664019Z 0 [Note] Forcefully disconnecting 0 remaining clients
2018-05-18T17:13:35.664042Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2018-05-18T17:13:35.664297Z 0 [Note] Binlog end
2018-05-18T17:13:35.664600Z 0 [Note] Shutting down plugin 'ngram'
2018-05-18T17:13:35.664606Z 0 [Note] Shutting down plugin 'partition'
2018-05-18T17:13:35.664608Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-05-18T17:13:35.664611Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-05-18T17:13:35.664613Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-05-18T17:13:35.664626Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-05-18T17:13:35.664629Z 0 [Note] Shutting down plugin 'MyISAM'
2018-05-18T17:13:35.664633Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-05-18T17:13:35.664635Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-05-18T17:13:35.664637Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-05-18T17:13:35.664639Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-05-18T17:13:35.664642Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-05-18T17:13:35.664644Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-05-18T17:13:35.664647Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-05-18T17:13:35.664649Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-05-18T17:13:35.664651Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-05-18T17:13:35.664653Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-05-18T17:13:35.664655Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-05-18T17:13:35.664656Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-05-18T17:13:35.664658Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-05-18T17:13:35.664660Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-05-18T17:13:35.664679Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-05-18T17:13:35.664681Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-05-18T17:13:35.664683Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-05-18T17:13:35.664684Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-05-18T17:13:35.664704Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-05-18T17:13:35.664707Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-05-18T17:13:35.664710Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-05-18T17:13:35.664713Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-05-18T17:13:35.664716Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-05-18T17:13:35.664718Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-05-18T17:13:35.664721Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-05-18T17:13:35.664723Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-05-18T17:13:35.664726Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-05-18T17:13:35.664729Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-05-18T17:13:35.664731Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-05-18T17:13:35.664734Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-05-18T17:13:35.664737Z 0 [Note] Shutting down plugin 'InnoDB'
2018-05-18T17:13:35.664782Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-05-18T17:13:35.664836Z 0 [Note] InnoDB: Starting shutdown...
2018-05-18T17:13:35.765117Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-05-18T17:13:35.765733Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180518 17:13:35
2018-05-18T17:13:36.876148Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12358623
2018-05-18T17:13:36.877709Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-05-18T17:13:36.877726Z 0 [Note] Shutting down plugin 'MEMORY'
2018-05-18T17:13:36.877730Z 0 [Note] Shutting down plugin 'CSV'
2018-05-18T17:13:36.877734Z 0 [Note] Shutting down plugin 'sha256_password'
2018-05-18T17:13:36.877737Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-05-18T17:13:36.877853Z 0 [Note] Shutting down plugin 'binlog'
2018-05-18T17:13:36.878244Z 0 [Note] mysqld: Shutdown complete
MySQL init process done. Ready for start up.
2018-05-18T17:13:37.094039Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-18T17:13:37.094848Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 1 ...
2018-05-18T17:13:37.096476Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-05-18T17:13:37.096487Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-18T17:13:37.096489Z 0 [Note] InnoDB: Uses event mutexes
2018-05-18T17:13:37.096491Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-18T17:13:37.096493Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-18T17:13:37.096495Z 0 [Note] InnoDB: Using Linux native AIO
2018-05-18T17:13:37.096660Z 0 [Note] InnoDB: Number of pools: 1
2018-05-18T17:13:37.096764Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-18T17:13:37.097649Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-18T17:13:37.101423Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-18T17:13:37.102524Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-05-18T17:13:37.113490Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-18T17:13:37.118382Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-18T17:13:37.118422Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-18T17:13:37.144885Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-18T17:13:37.145227Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-18T17:13:37.145233Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-18T17:13:37.145683Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 12358623
2018-05-18T17:13:37.145814Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-05-18T17:13:37.145944Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-05-18T17:13:37.147230Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180518 17:13:37
2018-05-18T17:13:37.147993Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-05-18T17:13:37.148106Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-18T17:13:37.149332Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-05-18T17:13:37.149350Z 0 [Note] IPv6 is available.
2018-05-18T17:13:37.149618Z 0 [Note] - '::' resolves to '::';
2018-05-18T17:13:37.149628Z 0 [Note] Server socket created on IP: '::'.
2018-05-18T17:13:37.150902Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-05-18T17:13:37.151475Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.151488Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.151493Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.151504Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.151507Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.151513Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.152505Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.152513Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-18T17:13:37.155455Z 0 [Note] Event Scheduler: Loaded 0 events
2018-05-18T17:13:37.155597Z 0 [Note] mysqld: ready for connections.
Version: '5.7.22' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) |
@tianon
|
In theory that might work, but I imagine there are probably parts of MySQL that don't enjoy having all files be |
@tianon I know it is ugly but OpenShift needs to run as random user in my case (not my decision!) The I also thought of copying the contents of The problem I have after running this is this error:
|
Have you tried ditching the |
The best way is to zip the files and extract them on runtime so the files have the correct owner as suggested on: |
Uh oh!
There was an error while loading. Please reload this page.
This image does not work with a prefilled container in OpenShift. (datadir=/var/lib/mysql2)
Dockerfile for
prefilledmysql:example
(I also thought about creating a multi stage build - I thought that might drop any problems connected with users)
docker run --user 123456789 prefilledmysql:example
results in
Is there any way to get this to work with a random UID when starting the container?
The text was updated successfully, but these errors were encountered: