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.

  • TLS error when using docker-machine driver digitalocean
  • How to limit aws instance ip range generated by ec2-instance create cli script?
  • Mesos-Marathon docker
  • Operate/control host hardware from within docker container
  • Kubernetes Kube-Proxy Server: Can it run without iptables' nat module?
  • Cannot start docker daemon on Arch Linux (4.8.13-1-ARCH)
  • 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?

  • Properly automate a docker script in Python
  • How to share dynamically generated secrets between Docker containers
  • getting to the files system of the Alpine linux which runs Docker-for-mac
  • why I can't ping my docker container?
  • Error on Zookeeper cluster mode with Docker?
  • Docker Volume not mounting any files
  • 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.