Code Monkey home page Code Monkey logo

Comments (3)

josecanhelp avatar josecanhelp commented on August 26, 2024 3

To add to this, I noticed that Takeout is now allowing passthrough parameters. However, there seems to be a small bug with that feature at the moment. I created a PR #302 to resolve this. Once we can get a fix merged in, it should be relatively simple to add a custom flag when enabling a container like so:

takeout enable mysql -- -v ~/Downloads:/var/downloads

from takeout.

josecanhelp avatar josecanhelp commented on August 26, 2024

It sounds like you want to mount a local path into the container so that a dump into that directory would be saved on your host system. Takeout does not offer a way to mount local paths. It only creates a default docker volume so that database data does not get lost when destroying a container.

By design, Takeout is opinionated in order to simplify the creation and destruction of service containers for developers that don't want to deal with the complexity of using vanilla docker commands.

What you are trying to do can be done with a little workaround. For example, you could grab the command that Takeout uses to enable your mysql container and add another -v flag. An example command might look like this:

docker run -p 3306:3306 \
        -e MYSQL_ROOT_PASSWORD=secret \
        -e MYSQL_ALLOW_EMPTY_PASSWORD=true \
        -e MYSQL_ROOT_HOST=% \
        -v mysql_data:/var/lib/mysql \
        -v ~/Downloads:/var/downloads \
        mysql/mysql-server:8.0.31-amd64 --default-authentication-plugin=mysql_native_password

Just note that creating a container manually like this means that Takeout has no knowledge of the container and cannot help enabling/disabling it. You would need to run vanilla docker commands to do that.

docker ps to list containers
docker stop CONTAINER_ID to stop containers
docker start CONTAINER_ID to start containers
docker rm CONTAINER_ID to remove containers
docker volume ls to list docker volumes
docker volume rm VOLUME_NAME to remove volumes

from takeout.

devajmeireles avatar devajmeireles commented on August 26, 2024

Hey, @josecanhelp !

Thank you for your reply. I think your PR will allow doing what I want in Takeout.

I (and I think a lot of other devs) use this "behavior" to provide a way to easily restore database dumps inside a MySQL container: I copy the dump to the "~/Downloads", and after that, I access it in a container and when I navigate to the "/var/downloads" I have my "~/Downloads" from the host, that contains the dump.sql.

from takeout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.