my docker-compose is picking up files from another folder, not from where I'm running the command -
upon going inside container, reason reads code location, don't know how , code being loaded here: /home/mean
but needed ( real code ) contents being uploaded here:
/opt/ltg/
here's docker-compose file contents, think issue volumes parameter.
when try go inside container, , html views, turns out linked folder used before.
i'm using https://github.com/meanjs/mean meanjs build project i'm using docker files, way of using docker.
version: '2' services: web: restart: build: . container_name: ltg ports: - "3000:3000" - "5858:5858" - "8080:8080" - "35729:35729" environment: - node_env=development - db_1_port_27017_tcp_addr=db depends_on: - db volumes_from: - web-data web-data: build: . entrypoint: /bin/true volumes: - ./:/opt/ltg - /opt/ltg/node_modules - /opt/ltg/public - /opt/ltg/uploads db: image: mongo:3.2 restart: ports: - "27017:27017" volumes_from: - db-data db-data: image: mongo:3.2 volumes: - /data/db - /var/lib/mongodb - /var/log/mongodb entrypoint: /bin/true
dockerfile. ( think issue here ) when change /home/mean /opt/ltg doesn't seem work.
node:0.12 # install gem sass grunt-contrib-sass run apt-get update -qq && apt-get install -y build-essential run apt-get install -y ruby run gem install sass workdir /opt/ltg # install mean.js prerequisites run npm install -g grunt-cli run npm install -g bower # install mean.js packages add package.json /opt/ltg/package.json run npm install # manually trigger bower. why doesnt work via npm install? add .bowerrc /opt/ltg/.bowerrc add bower.json /opt/ltg/bower.json run bower install --config.interactive=false --allow-root # make available start add . /opt/ltg # set development environment default env node_env development # port 3000 server # port 35729 livereload expose 3000 35729 cmd ["grunt"]
when go inside docker machine can see have code inside dont know why picking place.
docker inspect
± docker inspect e8a6e44e7a78 [ { "id": "e8a6e44e7a78825d5d4ebd9e165d24151e391e66478a5214f0ecd7badcf71d51", "created": "2016-11-11t21:51:59.315251772z", "path": "grunt", "args": [], "state": { "status": "running", "running": true, "paused": false, "restarting": false, "oomkilled": false, "dead": false, "pid": 6521, "exitcode": 0, "error": "", "startedat": "2016-11-11t21:52:00.23437815z", "finishedat": "0001-01-01t00:00:00z" }, "image": "sha256:8b93f26cc274bf69cd9e2c24161ef8b1a09acc958fb94027838897b0bf860d4e", "resolvconfpath": "/var/lib/docker/containers/e8a6e44e7a78825d5d4ebd9e165d24151e391e66478a5214f0ecd7badcf71d51/resolv.conf", "hostnamepath": "/var/lib/docker/containers/e8a6e44e7a78825d5d4ebd9e165d24151e391e66478a5214f0ecd7badcf71d51/hostname", "hostspath": "/var/lib/docker/containers/e8a6e44e7a78825d5d4ebd9e165d24151e391e66478a5214f0ecd7badcf71d51/hosts", "logpath": "/var/lib/docker/containers/e8a6e44e7a78825d5d4ebd9e165d24151e391e66478a5214f0ecd7badcf71d51/e8a6e44e7a78825d5d4ebd9e165d24151e391e66478a5214f0ecd7badcf71d51-json.log", "name": "/ltg", "restartcount": 0, "driver": "overlay2", "mountlabel": "", "processlabel": "", "apparmorprofile": "", "execids": null, "hostconfig": { "binds": [], "containeridfile": "", "logconfig": { "type": "json-file", "config": {} }, "networkmode": "ltg_default", "portbindings": { "3000/tcp": [ { "hostip": "", "hostport": "3000" } ], "35729/tcp": [ { "hostip": "", "hostport": "35729" } ], "5858/tcp": [ { "hostip": "", "hostport": "5858" } ], "8080/tcp": [ { "hostip": "", "hostport": "8080" } ] }, "restartpolicy": { "name": "always", "maximumretrycount": 0 }, "autoremove": false, "volumedriver": "", "volumesfrom": [], "capadd": null, "capdrop": null, "dns": null, "dnsoptions": null, "dnssearch": null, "extrahosts": null, "groupadd": null, "ipcmode": "", "cgroup": "", "links": null, "oomscoreadj": 0, "pidmode": "", "privileged": false, "publishallports": false, "readonlyrootfs": false, "securityopt": null, "utsmode": "", "usernsmode": "", "shmsize": 67108864, "runtime": "runc", "consolesize": [ 0, 0 ], "isolation": "", "cpushares": 0, "memory": 0, "cgroupparent": "", "blkioweight": 0, "blkioweightdevice": null, "blkiodevicereadbps": null, "blkiodevicewritebps": null, "blkiodevicereadiops": null, "blkiodevicewriteiops": null, "cpuperiod": 0, "cpuquota": 0, "cpusetcpus": "", "cpusetmems": "", "devices": null, "diskquota": 0, "kernelmemory": 0, "memoryreservation": 0, "memoryswap": 0, "memoryswappiness": -1, "oomkilldisable": false, "pidslimit": 0, "ulimits": null, "cpucount": 0, "cpupercent": 0, "iomaximumiops": 0, "iomaximumbandwidth": 0 }, "graphdriver": { "name": "overlay2", "data": { "lowerdir": "/var/lib/docker/overlay2/aedc2da47ce0785a68ea3786cf35eded82b6e5eb57e7083353d2c68ebfa1d15e-init/diff:/var/lib/docker/overlay2/ba7c11c0aac2c7c97c6f0d2876ed600b3724c0cabaa40d58f579db4573b4e8ed/diff:/var/lib/docker/overlay2/807a7a90f77a22724db8e54a57ad91b1ef1f2b06e88ad42524042f46c9da39d7/diff:/var/lib/docker/overlay2/14cbc06a270e4fddd6287d8f90cb2e885b1387be4dc0b79678f866b59e12063c/diff:/var/lib/docker/overlay2/369cc5f5a0ba13fe12e2d42d35f78f1bfcfdd80c0a0d64f0a22e9a6a036149aa/diff:/var/lib/docker/overlay2/854bf8973559090707e5d89c820ae70539392f9970b1646fb8178ff401ae3c5b/diff:/var/lib/docker/overlay2/d6db404071f5f6741dc2555bb87142f0fbfb511a7c70f03085ddcae108bbf5ae/diff:/var/lib/docker/overlay2/869b67fd3eb7e0f4856433eddd0dd1604170bf8d70c97070a4c1866c46a82024/diff:/var/lib/docker/overlay2/2fa6daceeb2d0b83fcb08a8b46d8894f182c8e2bb206e87d5af0e7fc73452c29/diff:/var/lib/docker/overlay2/b61d40c66620b7088c0ba4d37e776eef9a40ece901cf2e1ead26c8cbde3ebfe5/diff:/var/lib/docker/overlay2/c2470f33522483b8c7f2651e24ebee088f27fcdac2b8b93e9183e5d022ebc883/diff:/var/lib/docker/overlay2/a48f7cee20a989218f7eb20a8d6bc0b31a3c3e4e968a0a5271a13297a2b37b89/diff:/var/lib/docker/overlay2/e69b54cfe8a5a5c5cacf5e77603bd6e24695dba569c6bf5b0c9788f4b008c22c/diff:/var/lib/docker/overlay2/2dd3ff884efc421fed1e548a4b0c6c633dd59b62c077811718ed5b7bf0fde7fd/diff:/var/lib/docker/overlay2/b5c1cc249ce2798dbfff752cd2f4878bc7777951cd11013ceecb44d0eb933aff/diff:/var/lib/docker/overlay2/e9006ecc5d8f18345f402c96e9149b2b0dd6689d1d476b896049237ea41de404/diff:/var/lib/docker/overlay2/2debe0ee8462910da0e18bbd9ac6c1c902b157f7b15b23f866add9163d008aa3/diff:/var/lib/docker/overlay2/d0bc087a8ea87721eb7feb31dd7999e6e9755e991b88f4e728fc93669ee8590e/diff:/var/lib/docker/overlay2/76deca402cfba36204612590cb0de02a5ff8fab6d6053263af0a81e6da79fb78/diff:/var/lib/docker/overlay2/737638f3bceb8c85288c3477da936e3b523dbabd787e72989e639df24195329b/diff", "mergeddir": "/var/lib/docker/overlay2/aedc2da47ce0785a68ea3786cf35eded82b6e5eb57e7083353d2c68ebfa1d15e/merged", "upperdir": "/var/lib/docker/overlay2/aedc2da47ce0785a68ea3786cf35eded82b6e5eb57e7083353d2c68ebfa1d15e/diff", "workdir": "/var/lib/docker/overlay2/aedc2da47ce0785a68ea3786cf35eded82b6e5eb57e7083353d2c68ebfa1d15e/work" } }, "mounts": [], "config": { "hostname": "e8a6e44e7a78", "domainname": "", "user": "", "attachstdin": false, "attachstdout": false, "attachstderr": false, "exposedports": { "3000/tcp": {}, "35729/tcp": {}, "5858/tcp": {}, "8080/tcp": {} }, "tty": false, "openstdin": false, "stdinonce": false, "env": [ "node_env=development", "db_1_port_27017_tcp_addr=db", "no_proxy=*.local, 169.254/16", "path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "node_version=0.12.17" ], "cmd": [ "grunt" ], "image": "ltg_web", "volumes": null, "workingdir": "/home/mean", "entrypoint": null, "onbuild": null, "labels": { "com.docker.compose.config-hash": "7a3cb3d6a460fc5a975aafe44279ec835e5bb92141ae537ac0fd044c94243abe", "com.docker.compose.container-number": "1", "com.docker.compose.oneoff": "false", "com.docker.compose.project": "ltg", "com.docker.compose.service": "web", "com.docker.compose.version": "1.9.0-rc2" } }, "networksettings": { "bridge": "", "sandboxid": "a1b78ae1a7e589977a6f23e1fe1274bb494324b7ce7b9f99d16bb7e78678f721", "hairpinmode": false, "linklocalipv6address": "", "linklocalipv6prefixlen": 0, "ports": { "3000/tcp": [ { "hostip": "0.0.0.0", "hostport": "3000" } ], "35729/tcp": [ { "hostip": "0.0.0.0", "hostport": "35729" } ], "5858/tcp": [ { "hostip": "0.0.0.0", "hostport": "5858" } ], "8080/tcp": [ { "hostip": "0.0.0.0", "hostport": "8080" } ] }, "sandboxkey": "/var/run/docker/netns/a1b78ae1a7e5", "secondaryipaddresses": null, "secondaryipv6addresses": null, "endpointid": "", "gateway": "", "globalipv6address": "", "globalipv6prefixlen": 0, "ipaddress": "", "ipprefixlen": 0, "ipv6gateway": "", "macaddress": "", "networks": { "ltg_default": { "ipamconfig": null, "links": null, "aliases": [ "web", "e8a6e44e7a78" ], "networkid": "cdde7613dceaf26fac855d124172f3b0606ab685585a69974e87c4f4ed4fed6c", "endpointid": "b4618fb75407538391035f610281374407c9b9a513028ccf981a390d689dbe93", "gateway": "172.19.0.1", "ipaddress": "172.19.0.3", "ipprefixlen": 16, "ipv6gateway": "", "globalipv6address": "", "globalipv6prefixlen": 0, "macaddress": "02:42:ac:13:00:03" } } } } ]
i dont undersatnd /home/mean coming inside variable
"workingdir": "/home/mean",
i think need little more information answer question. assume things.
the
opt/ltg
directory points directory docker-compose.yml located, not directory run docker-compose. same directory. try make modification docker-compose.yml add comment. go containerdocker exec
, check content of docker-compose.yml, added comment should there.i assume html files go
/opt/ltg/public
declared volume also. docker create directory in host different current directory. usedocker inspect
see they. if rundocker-compose down -v
should rid of files.don't overlap volumes unless need to. recommend use docker-compose.yml instead:
docker-compose.yml
version: '2' services: web: restart: build: . container_name: ltg ports: - "3000:3000" - "5858:5858" - "8080:8080" - "35729:35729" environment: - node_env=development - db_1_port_27017_tcp_addr=db depends_on: - db volumes_from: - web-data web-data: build: . entrypoint: /bin/true volumes: - ./:/opt/ltg db: image: mongo:3.2 restart: ports: - "27017:27017" volumes_from: - db-data db-data: image: mongo:3.2 volumes: - /data/db - /var/lib/mongodb - /var/log/mongodb entrypoint: /bin/true
regards
Comments
Post a Comment