I am having a problem with the image when using it with docker-compose, something makes the container to shutdown after running docker-compose up.
Here is my docker-compose.yml file:
version: '2'
services:
web:
image: messenger
ports:
- "8000:8000"
environment:
MYSQL_USER: marwan
MYSQL_PASSWORD: <pass>
MYSQL_DATABASE: messenger
depends_on:
- mysql
- elastic
mysql:
image: mysql
environment:
MYSQL_USER: marwan
MYSQL_PASSWORD: <pass>
MYSQL_DATABASE: messenger
MYSQL_ROOT_PASSWORD: <pass>
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.2
ports:
- 9200:9200
and here is the output:
Attaching to messenger_mysql_1, messenger_elastic_1, messenger_web_1
mysql_1 | 2017-09-01T10:01:43.480240Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1 | 2017-09-01T10:01:43.481789Z 0 [Note] mysqld (mysqld 5.7.19) starting as process 1 ...
mysql_1 | 2017-09-01T10:01:43.485266Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql_1 | 2017-09-01T10:01:43.485302Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1 | 2017-09-01T10:01:43.485306Z 0 [Note] InnoDB: Uses event mutexes
mysql_1 | 2017-09-01T10:01:43.485310Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql_1 | 2017-09-01T10:01:43.485314Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
mysql_1 | 2017-09-01T10:01:43.485321Z 0 [Note] InnoDB: Using Linux native AIO
mysql_1 | 2017-09-01T10:01:43.485652Z 0 [Note] InnoDB: Number of pools: 1
mysql_1 | 2017-09-01T10:01:43.485777Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql_1 | 2017-09-01T10:01:43.487402Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql_1 | 2017-09-01T10:01:43.495110Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql_1 | 2017-09-01T10:01:43.497050Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql_1 | 2017-09-01T10:01:43.509905Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql_1 | 2017-09-01T10:01:43.510822Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2539618
mysql_1 | 2017-09-01T10:01:43.510851Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2539872
mysql_1 | 2017-09-01T10:01:43.510897Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 2539618 and the end 2539872.
mysql_1 | 2017-09-01T10:01:43.510934Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
mysql_1 | 2017-09-01T10:01:44.111639Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
mysql_1 | 2017-09-01T10:01:44.111678Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysql_1 | 2017-09-01T10:01:44.111690Z 0 [ERROR] Failed to initialize plugins.
mysql_1 | 2017-09-01T10:01:44.111695Z 0 [ERROR] Aborting
mysql_1 |
mysql_1 | 2017-09-01T10:01:44.111711Z 0 [Note] Binlog end
mysql_1 | 2017-09-01T10:01:44.111801Z 0 [Note] Shutting down plugin 'CSV'
mysql_1 | 2017-09-01T10:01:44.112663Z 0 [Note] mysqld: Shutdown complete
mysql_1 |
messenger_mysql_1 exited with code 1
What am I doing wrong?
Hi, I seem to have an identical error and it's got me stumped. Did you get yours fixed?
Attaching to website_db_1
db_1 | 2017-09-07T17:37:49.273674Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for mor
e details).
db_1 | 2017-09-07T17:37:49.279120Z 0 [Note] mysqld (mysqld 5.7.19) starting as process 1 ...
db_1 | 2017-09-07T17:37:49.289423Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2017-09-07T17:37:49.289447Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2017-09-07T17:37:49.289450Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2017-09-07T17:37:49.289453Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2017-09-07T17:37:49.289455Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
db_1 | 2017-09-07T17:37:49.289463Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2017-09-07T17:37:49.289743Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2017-09-07T17:37:49.289876Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2017-09-07T17:37:49.291077Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2017-09-07T17:37:49.296618Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2017-09-07T17:37:49.297952Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2017-09-07T17:37:49.326706Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2017-09-07T17:37:49.329011Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 95265228
db_1 | 2017-09-07T17:37:49.329032Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 95267309
db_1 | 2017-09-07T17:37:49.329085Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 95265228 and the end 95267309.
db_1 | 2017-09-07T17:37:49.329097Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
db_1 | 2017-09-07T17:37:49.930134Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
db_1 | 2017-09-07T17:37:49.930205Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
db_1 | 2017-09-07T17:37:49.930217Z 0 [ERROR] Failed to initialize plugins.
db_1 | 2017-09-07T17:37:49.930223Z 0 [ERROR] Aborting
db_1 |
db_1 | 2017-09-07T17:37:49.930232Z 0 [Note] Binlog end
db_1 | 2017-09-07T17:37:49.930330Z 0 [Note] Shutting down plugin 'CSV'
db_1 | 2017-09-07T17:37:49.933545Z 0 [Note] mysqld: Shutdown complete
db_1 |
website_db_1 exited with code 1
@ijmccallum It was two things:
@ijmccallum This is my docker-compose.yml file:
version: '2'
services:
web:
build: .
ports:
- "8000:8000"
environment:
MYSQL_USER: marwan
MYSQL_HOST: db
MYSQL_PASSWORD: <password>
MYSQL_DATABASE: messenger
restart: always
links:
- db
- elasticsearch
db:
image: mysql
restart: always
environment:
MYSQL_USER: marwan
MYSQL_PASSWORD: <password>
MYSQL_DATABASE: messenger
MYSQL_ROOT_PASSWORD: <password>
elasticsearch:
image: elasticsearch:5
command: elasticsearch
expose:
- "9200"
- "9300"
volumes:
- "/tmp/esdata:/usr/share/elasticsearch/data"
and this is the Go code where I connect to mysql:
func Init() {
var err error
dbj, err = jet.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:3306)/%s", os.Getenv("MYSQL_USER"), os.Getenv("MYSQL_PASSWORD"), os.Getenv("MYSQL_HOST"), os.Getenv("MYSQL_DATABASE")))
if err != nil {
fmt.Println(err)
time.Sleep(5 * time.Second)
Init()
return
}
err = dbj.Ping()
if err != nil {
fmt.Println(err)
time.Sleep(5 * time.Second)
Init()
return
}
println("Connected to MySql.")
}
These sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. :wink: Thanks!
I had this issue after a forced restart of the Docker daemon. What helped was connecting to the DB instance:
docker-compose run --rm db /bin/bash
Then deleting the following files:
rm -rf /var/lib/mysql/ib_logfile*
As far as I can tell, this did not cause any data loss, but be sure to have backups.
After a backup of my volumes i did what @slhck say and got my DB up with no data lose
@slhck It causes data loss. Please make a backup before running those lines.
Most helpful comment
I had this issue after a forced restart of the Docker daemon. What helped was connecting to the DB instance:
Then deleting the following files:
As far as I can tell, this did not cause any data loss, but be sure to have backups.