我的Dockerfile:
FROM mysql:5.6
ENV MYSQL_ROOT_PASSWORD=pass
ENV MYSQL_DATABASE=some_db
ENV MYSQL_USER=some_user
ENV MYSQL_PASSWORD=pass
我使用此命令运行容器
docker run --name mymysql --rm -it -p 3306:3306 mysql
脚本在这里开始和停止。
... some logs
MySQL init process done. Ready for start up.
2018-06-15 12:15:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-06-15 12:15:49 0 [Note] mysqld (mysqld 5.6.40) starting as process 1 ...
2018-06-15 12:15:49 1 [Note] Plugin 'FEDERATED' is disabled.
2018-06-15 12:15:49 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-06-15 12:15:49 1 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-15 12:15:49 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-15 12:15:49 1 [Note] InnoDB: Memory barrier is not used
2018-06-15 12:15:49 1 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-15 12:15:49 1 [Note] InnoDB: Using Linux native AIO
2018-06-15 12:15:49 1 [Note] InnoDB: Using CPU crc32 instructions
2018-06-15 12:15:49 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-15 12:15:49 1 [Note] InnoDB: Completed initialization of buffer pool
2018-06-15 12:15:49 1 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-15 12:15:49 1 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-15 12:15:49 1 [Note] InnoDB: Waiting for purge to start
2018-06-15 12:15:49 1 [Note] InnoDB: 5.6.40 started; log sequence number 1625997
2018-06-15 12:15:49 1 [Note] Server hostname (bind-address): '*'; port: 3306
2018-06-15 12:15:49 1 [Note] IPv6 is available.
2018-06-15 12:15:49 1 [Note] - '::' resolves to '::';
2018-06-15 12:15:49 1 [Note] Server socket created on IP: '::'.
2018-06-15 12:15:49 1 [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-06-15 12:15:49 1 [Warning] 'proxies_priv' entry '@ root@1804588a972e' ignored in --skip-name-resolve mode.
2018-06-15 12:15:49 1 [Note] Event Scheduler: Loaded 0 events
2018-06-15 12:15:49 1 [Note] mysqld: ready for connections.
Version: '5.6.40' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
....NOTHING HAPPENS
我需要一个运行容器并直接启动mysql-client的命令。