mkdir command with docker

Inside my docker container, this command mkdir -p -m 755 directoryName creates a directory (Blue File) at the given path. However, outside docker, when I attempt to create a directory with the same command mkdir -p -m 755 ContainerID:/root/.../directoryName it seems to be creating an Executable (Green File).

This is causing trouble because with my “create directory” command i’m copying stuff to it, and the command is failing when I do it outside of docker.

  • how to clear cache memory inside docker container
  • What is /usr/sbin/service doing under a Docker container
  • How do you add items to .dockerignore?
  • link_to strips port from site hosted in container
  • Dockerize Logstash, Redis setup
  • How copy files from current docker container to another container
  • This is what my full command will be, when I execute outside docker:

    mkdir -p -m 755 ContainerID:/root/../dirName && docker cp someImage.jpg ContainerID:/root/../dirName

    Any thoughts on how to to make this work?

  • Composition of services is it possible with kubernetes?
  • Docker/Boot2Docker: Set HTTP/HTTPS proxies for docker on OS X
  • Docker - AWS - What do I need to do next?
  • Why does my automated build run so slowly inside a Docker container?
  • one compatibility issue about docker
  • Setting up logs location for Docker Logstash image
  • One Solution collect form web for “mkdir command with docker”

    To be honest, I have never heard of such mkdir syntax, referencing a different host, but in any case (even if it was supported) I would not use it. You should execute anything you want to to inside a docker container as docker exec ContainerID mkdir -p -m 755 /root/../dirName

    If you want to put several commands inside the same docker exec call you can do it by executing docker exec ContainerID bash -c "whatever && whatever2 && ... whateverX"

    Have in mind that these commands will be executed as the user referenced in the Dockerfile with an USER clause, defaulting to root. There are some images in which the user is set to something different, leading to permission issues while doing stuff like this. The right approach to follow would depend on whatever you want to achieve.

    Hope that helps! 🙂

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.