0

I've pulled MySQL image from docker hub and tried to run it using

docker run (-i) (-t) -d -p 3306:3306 --name test-mysql -e MYSQL_ROOT_PASSWORD=password -d mysql:latest —innodb_buffer_pool_size=1G —character-set-server=utf8 —collation-server=utf8_general_ci —lower_case_table_names=1

but the container exits immediately. Output for docker ps is empty while output for docker ps -a is:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                       PORTS               NAMES
93ffbf44b3c6        mysql:latest        "docker-entrypoint..."   9 seconds ago       Exited (127) 8 seconds ago                       test-mysql

docker images

REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
centos/mysql-56-centos7   latest              1d5bc23ca83b        25 hours ago        401MB
mysql                     latest              11615e225c92        5 days ago          408MB

I'm running docker on CentOS on AWS and from MySQL's Docker file I can see that the image uses a Debian base.

I've also tried to run the image both on the foreground and the background but neither seem to work.

I've tried using a CentOS base as well but even this exits immediately.

I'm running docker as root.

2 Answers 2

2

First things first. It doesn't matter what OS you're running. It doesn't matter which OS is the image build on. That's the power of Docker. You can run CentOS-based container in Ubuntu and vice versa.

If container exited, there was some error while running processes inside the container. Code 128 is too ambiguous. To find out what really prevent you from running MySQL container take a look at container logs:

docker logs [containerId]

Sign up to request clarification or add additional context in comments.

Comments

1

The error was on the run command itself. Double instead of single dashes should have been used for overriding database configuration properties. So the correct docker run command is the following

docker run -d -p 3306:3306 --name test-mysql -e MYSQL_ROOT_PASSWORD=password -d mysql:latest --innodb_buffer_pool_size=1G --character-set-server=utf8 --collation-server=utf8_general_ci --lower_case_table_names=1

Thanks for the hint @Sergey Kovalev

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.