creating /tmp directory inside docker

I have the following Docker file which runs a node.js application

#!/usr/bin/bash
set -e

TYPE=$1
REPO_URL=https://api.github.com/repos/nkhine/domain/tarball/$2
APP=web-$TYPE
APPENV=/ccc/$APP.env
ls $APPENV > /dev/null
echo using $APPENV

source /ccc/build.env

BUILDID=`date +%Y%m%d.%H%M%S`
BUILDDIR=/ccc/build/$APP-$BUILDID
CACHEDIR=/ccc/build/cache
CACHEFILE=$CACHEDIR/$APP.tar.gz
mkdir -p $BUILDDIR
mkdir -p $CACHEDIR

echo [== downloading $REPO_URL to $BUILDDIR ==]
cd $BUILDDIR
curl -H "Authorization: token $GITHUB_TOKEN" -L $REPO_URL | tar --extract --gzip
cd *

echo [== building docker on `pwd` ==]
IMAGE=$APP:$BUILDID
CONTAINER=$APP
cp $CACHEFILE cache.tar.gz || true
basename `pwd` > git_commit_id

docker build -t $IMAGE .
cd /ccc
rm -Rf $BUILDDIR
docker run --rm $IMAGE cat cache.tar.gz > $CACHEFILE

echo [== restarting docker ==]
docker stop $APP || true
docker rm $APP || true
docker run -d --restart always --name $APP \
    -v /tmp:/ccc/tmp \
    --link euvat:euvat \
    --link freegeoip:freegeoip \
    --link redis-$TYPE:redis \
    --link mongo-$TYPE:mongo \
    --env VIRTUAL_HOST=$TYPE.domain.tld \
    --env-file $APPENV \
    $IMAGE

echo [== tailing docker logs press [Ctrl + C] to cancel ==]
docker logs --tail=100 -f $APP

but when i inspect /ccc/tmp has not been loaded into the container into /tmp

  • Docker RUN fails with “returned a non-zero code: 6”
  • Docker installation on OpenSUSE 13.1
  • how to securely connect to a mysql server running on a virtual machine
  • How do you run script like tasks in Docker Compose
  • What is the most simple setup for a MEAN stack docker container to have the same config on OS X and DigitalOcean?
  • can't save docker images
  • khine@arawaak ~ $ docker inspect web-dev
    [
    {
        "Id": "e124e93ca6b92e868ea7fd7fae1ed8a28d3b64302fe72ed771f06c761dedc9cd",
        "Created": "2015-11-19T11:03:41.187310483Z",
        "Path": "node",
        "Args": [
            "run.js"
        ],
        "State": {
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 1247,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2015-11-19T11:03:41.543628736Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "796201c12ace9547173ea57b38a4e199178bf7fe4e1dfdb686d5029871364411",
        "NetworkSettings": {
            "Bridge": "",
            "NetworkID": "be5690b03359d5214b8a1670e62eb91d618e5a7b2fa3a0fdb1ce3dd27ab21d0a",
            "PortMapping": null,
            "Ports": {
                "3000/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/e124e93ca6b9",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null
        },
        "ResolvConfPath": "/var/lib/docker/containers/e124e93ca6b92e868ea7fd7fae1ed8a28d3b64302fe72ed771f06c761dedc9cd/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/e124e93ca6b92e868ea7fd7fae1ed8a28d3b64302fe72ed771f06c761dedc9cd/hostname",
        "HostsPath": "/var/lib/docker/containers/e124e93ca6b92e868ea7fd7fae1ed8a28d3b64302fe72ed771f06c761dedc9cd/hosts",
        "LogPath": "/var/lib/docker/containers/e124e93ca6b92e868ea7fd7fae1ed8a28d3b64302fe72ed771f06c761dedc9cd/e124e93ca6b92e868ea7fd7fae1ed8a28d3b64302fe72ed771f06c761dedc9cd-json.log",
        "Name": "/web-dev",
        "RestartCount": 0,
        "Driver": "overlay",
        "ExecDriver": "native-0.2",
        "MountLabel": "",
        "ProcessLabel": "",
        "Volumes": {},
        "VolumesRW": {},
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LxcConf": [],
            "Memory": 0,
            "MemorySwap": 0,
            "CpuShares": 0,
            "CpuPeriod": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "CpuQuota": 0,
            "BlkioWeight": 0,
            "OomKillDisable": false,
            "Privileged": false,
            "PortBindings": {},
            "Links": [
                "/euvat:/web-dev/euvat",
                "/freegeoip:/web-dev/freegeoip",
                "/mongo-dev:/web-dev/mongo",
                "/redis-dev:/web-dev/redis"
            ],
            "PublishAllPorts": false,
            "Dns": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "VolumesFrom": null,
            "Devices": [],
            "NetworkMode": "bridge",
            "IpcMode": "",
            "PidMode": "",
            "UTSMode": "",
            "CapAdd": null,
            "CapDrop": null,
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "SecurityOpt": null,
            "ReadonlyRootfs": false,
            "Ulimits": null,
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "CgroupParent": ""
        },
        "Config": {
            "Hostname": "e124e93ca6b9",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "PortSpecs": null,
            "ExposedPorts": {
                "3000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=0.10.40",
                "NPM_VERSION=2.13.3",
                "PORT=3000",
                "NODE_ENV=production"
            ],
            "Cmd": [
                "node",
                "run.js"
            ],
            "Image": "web-dev:20151119.110235",
            "Volumes": null,
            "VolumeDriver": "",
            "WorkingDir": "/usr/src/app",
            "Entrypoint": null,
            "NetworkDisabled": false,
            "MacAddress": "",
            "OnBuild": null,
            "Labels": {}
        }
    }
    ]
    

    any advise much appreciated, my use case is that i am using phantomjs to create a PDF file, which is then emailed to the client.

  • How to allocate more memory for docker container?
  • sbin/start-stop-daemon not able to start python - ubuntu docker container
  • Access to mysql container from other container
  • How to use a bash script in Alpine Linux?
  • Docker seccomp not working on Kali
  • How to externalize the docker container file
  • One Solution collect form web for “creating /tmp directory inside docker”

    You got the options backwards. You should use:

    -v /ccc/tmp:/tmp
    

    Mount a host directory as a data volume

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