docker "cp foo.txt mycontainer:/PATH/" does not work

  • Dear people,


    I have started working with Docker today.

    Not primarily to learn Docker, but I have an application to install, elche is pre-installed under Docker. I find this practical and convenient.

    So far everything works fine. But somehow I misunderstand the Docker documentation. I want to copy a file from the host to the Docker instance.


    I have a Docker instance running:


    Code
    $ docker ps
    CONTAINER ID IMAGE COMMAND     CREATED STATUS         PORTS NAMES
    54e99d73543f od    "/bin/bash" 2 hours ago Up 2 hours       compassionate_bartik


    This syntax "docker cp foo.txt mycontainer:/" does not work.


    The command

    Code
    docker cp test.txt compassionate_bartik:/ 

    is executed, no error message is displayed, but no file is copied.



    Only this construction works:

    Code
    tar -cv *.txt | docker exec -i compassionate_bartik tar x -C .


    What did I get wrong with the command "docker cp"?


    How do you copy or export data into the docker container? Or don't you do that?


    Best regards

    Joern

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!