MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, used by high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more.
This MySQL distribution is provided by the upstream MySQL packaging team.
Run a temporary MySQL container with random root password
docker run --rm -e MYSQL_RANDOM_ROOT_PASSWORD=yes -it sourcemation/mysql
docker run --name mysql-server \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-p 3306:3306 \
-d sourcemation/mysql
docker run --name mysql-server \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-e MYSQL_DATABASE=myapp \
-e MYSQL_USER=myuser \
-e MYSQL_PASSWORD=mypass \
-p 3306:3306 \
-d sourcemation/mysql
docker run --name mysql-server \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-v mysql-data:/var/lib/mysql \
-p 3306:3306 \
-d sourcemation/mysql
docker run --name mysql-server \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-v /path/to/init-scripts:/docker-entrypoint-initdb.d:ro \
-v mysql-data:/var/lib/mysql \
-p 3306:3306 \
-d sourcemation/mysql
The sourcemation/mysql image itself comes in debian-12 flavor. The tag latest refers to the Debian-based flavor.
We are not building a MySQL image for the arm64 architecture. The official MySQL repository doesn't provide packages for the arm64 architecture.
This image uses the following environment variables:
MYSQL_ROOT_PASSWORD=<password> # Set root password
MYSQL_RANDOM_ROOT_PASSWORD=no
MYSQL_ALLOW_EMPTY_PASSWORD=no
# Optional database creation:
MYSQL_DATABASE=<database_name> # Create database on startup
MYSQL_USER=<username> # Create user on startup
MYSQL_PASSWORD=<password> # Password for MYSQL_USER
# Additional options:
MYSQL_INITDB_SKIP_TZINFO=no # Skip timezone info loading
This image exposes the following ports:
3306 - MySQL server portThis image defines the following volumes:
/var/lib/mysql - Database data directory/docker-entrypoint-initdb.d - Initialization scripts directoryPlease note that the ports need to be either manually forwarded with the -p option or let Docker choose some for you with the -P option.
We'd love for you to contribute! You can request new features, report bugs, or submit a pull request with your contribution to this image on the Sourcemation GitHub repository.
Disclaimer: The sourcemation/mysql image is not affiliated with Oracle Corporation. The respective companies and organisations own the trademarks mentioned in the offering. The sourcemation/mysql image is a separate project and is maintained by Sourcemation.
The container supports initialization scripts that will be executed when the database is first created. Place your scripts in the /docker-entrypoint-initdb.d directory:
*.sh files will be executed as shell scripts*.sql files will be executed as SQL scripts*.sql.gz and *.sql.xz files will be decompressed and executed as SQL scriptsmysql user (non-root) for improved securityA detailed risk analysis report of the image and its components can be found on the Sourcemation platform.
For more information, check out the overview of MySQL page.
The base license for the solution (MySQL Community Server) is the GPLv2. The licenses for each component shipped as part of this image can be found on the image's appropriate Sourcemation entry.
Content type
Image
Digest
sha256:7ab87a5ef…
Size
126.7 MB
Last updated
5 days ago
docker pull sourcemation/mysql