12/28/2021

Ubuntu Mysql Docker

84
  1. I have also tried running a MySQL container with the -d flag then running a fresh ubuntu 14.04 container (docker.io run -it -link mysql:mysql ubuntu:14.04 bash) linked to it. On the Ubuntu container I installed mysql-client through apt-get and tried to connect to the MySQL container on the ip address in MYSQLPORT3306TCPADDR but that doesn.
  2. Starting a MySQL instance is simple: $ docker run -name some-mysql -e MYSQLROOTPASSWORD=my-secret-pw -d mysql:tag. Where some-mysql is the name you want to assign to your container, my-secret-pw is the password to be set for the MySQL root user and tag is the tag specifying the MySQL version you want. See the list above for relevant tags.

In mysql-server service, all the contents of the /var/lib/mysql directory will be saved permanently in the mysql-data volume.’ In the web-server service, the container port 80 (right) is mapped to the Docker host port 8080 (left).’.


Docker Hub Mysql Ubuntu

Posted by: Ben Kellermann
Date: April 13, 2018 11:41AM

Hey Guys -
Recently I set up an Atomic Docker Host (Fedora-based) in my home lab. My plan is to migrate many service applications that I have spread out to it which should give me some base experience with Docker and such. One of the first things I'm trying to do is migrate a mySQL Database over.
I have a mySQL 5.7.21 Database running on an Ubunutu system which I use for my home's Kodi library. I've found that it seems simple to move a database to another server by dumping it, copying, then importing it; I just am not sure how to do that with a mysql Docker Container.
I've already pulled the image by executing 'docker pull mysql' on my Docker host, but am not 100% sure how to proceed beyond that to get the DB imported. Below is what I think I need to do - could someone please verify and correct if needed?
1. Pull the mySQL Docker image (done)
2. Start a new mysql instance by executing something like 'docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag'
3. Copy the database from the Ubuntu host to a path on the Atomic (Docker) host using SCP
4. Import the new database.
I see that the mysql command to import it would be something like
'mysql -u root -p newdatabase < /path/to/newdatabase.sql'
but I'm not sure the best way to go about it with Docker. It seems that I can create a new container to run mySQL command line by executing something like 'docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h'$MYSQL_PORT_3306_TCP_ADDR' -P'$MYSQL_PORT_3306_TCP_PORT' -uroot -p'$MYSQL_ENV_MYSQL_ROOT_PASSWORD''
but not sure it's the best way to go about it. If so, how would I reference the file(s) I copied over to the Docker host for import?
Any help would be greatly appreciated - Thanks!

Options:Reply•Quote

Written By

Sorry, you can't reply to this topic. It has been closed.
Ubuntu Mysql Docker

Ubuntu Docker Mysql 8

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.

  • Most Viewed News

    • Mac Startup Programs
    • Transfer Music From Macbook Air To Iphone
    • Install Vi Ubuntu Docker