How could I get files from a docker container running the official etcd image if there is no shell?

I have a docker container that is running the etcd docker image by CoreOS which can be found here: What I want to do is copy all the files that are saved in etcd’s data directory locally. I tried to connect to the container using docker exec -it etcd /bin/sh but it seems like there is no shell (/bin/bash, /bin/sh) on there or at least it can’t be found on the $PATH variable. How can I either get onto the image or get all the data files inside of etcd copied locally?

  • Installation of system tables failed! boot2docker tutum/mysql mount file volume on Mac OS
  • pdf2htmlEX cannot open or read file
  • Is it possible to log into Gitlabs container registry without using the CI runner?
  • Talking to remote docker from Linux to Windows
  • Laravel MySQL Error ONLY on Scheduled Tasks (via cron)
  • Adding nodes to docker swarm
  • How can I redirect a single port in a docker container to the container's host?
  • docker run command change to .yaml file
  • Running multiple dependent apps each with their own docker compose file
  • Why can't I “freopen” a “tmpfile”?
  • How do a see the “ancestor tree” of a docker-compose file
  • Jenkins docker plugin + commit docker slave, how to push it to a external registry. Image saved on docker host configured in cloud template
  • 2 Solutions collect form web for “How could I get files from a docker container running the official etcd image if there is no shell?”

    You can export the contents of an image easily:

    docker export <CONTAINER ID> > /some_file.tar

    Ideally you should use volumes so that all your data is stored outside the container. Then you can access those files like any other file.

    Docker has the cp command for copying files between container and host:

    docker cp <id>:/container/source /host/destination

    You specify the container ID or name in the source, and you can flip the command round to copy from your host into the container:

    docker cp /host/source <id>:/container/destination
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.