Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare docker volumes via config #34

Closed
cmelion opened this issue May 15, 2016 · 2 comments
Closed

Declare docker volumes via config #34

cmelion opened this issue May 15, 2016 · 2 comments

Comments

@cmelion
Copy link
Owner

cmelion commented May 15, 2016

Volumes are currently declared via -v command-line arguments to docker run, making it difficult to add and remove files and directories when changes to the default configs for the image are needed.

"docker-start": "docker run --rm --name ${PWD##*/} -i -p 2368:2368 
-v $(pwd)/package.json:/home/yeoman/client/package.json 
-v $(pwd)/src:/home/yeoman/client/src 
-v $(pwd)/api:/home/yeoman/client/api 
cmelion/generator-ng2-webpack:latest"

The above would be fine, but the json format does not allow multi-line strings.

Investigate using docker-run:

{
  net: 'bridge',    // network mode (auto | host | bridge). defaults to bridge 
  tty: true,        // be a tty. defaults to false 
  fork: true,       // fork (do not attach stdio). defaults to false 
  remove: true,     // remove the container on stop. defaults to true 
  dns: ['8.8.8.8'], // set custom dns servers 
  ports: {
    8080: 8081      // expose container 8080 to host 8081 
  },
  volumes: {
    '/root': '/tmp', // expose container /root to host /tmp 
    '/root': '/tmp2:ro' // expose container /root to host /tmp2 as read only 
  },
  links: {
    'container-name': 'alias' // link container-name as alias 
  },
  env: {
    FOO: 'bar'      // set env vars 
  },
  entrypoint: '/bin/bash' // override entrypoint on container 
}

@cmelion
Copy link
Owner Author

cmelion commented May 16, 2016

docker-run is not working as expected.
mafintosh/docker-run#9

@cmelion
Copy link
Owner Author

cmelion commented Jun 5, 2016

switched to using docker-compose. Configuration is now done via docker-compose.yml:

web:
  image: cmelion/generator-ng2-webpack:latest
  volumes:
    - ./package.json:/home/yeoman/client/package.json
    - ./src:/home/yeoman/client/src
    - ./json-server:/home/yeoman/client/json-server
  ports:
    - "2368:2368"
    - "3000:3000"

@cmelion cmelion closed this as completed Jun 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant