Dockerode: Sample for setting volumes,ports when create container is required

Created on 10 Nov 2017  路  2Comments  路  Source: apocas/dockerode

RT,
I searched for entire repository and still get no idea.

question

Most helpful comment

you must read and understand the docker remote api, referrenced at the top of the repo. example

    var staticServer = await docker.createContainer({
      Hostname: 'static',
      Image: 'node',
      Cmd: ['node', '/adapter/node_modules/.bin/httpster', '-d', '/static'],
      HostConfig: {
        AutoRemove: true,
        Binds: [
          `${projectRoot}:/adapter`,
          `${tempStaticDir}:/static`
        ]
      },
      ExposedPorts: {
        '3333/tcp': {}
      },
      NetworkingConfig: {
        EndpointsConfig: {
          [networkName]: {
            Aliases: [
              'static'
            ]
          }
        }
      }
    })

All 2 comments

you must read and understand the docker remote api, referrenced at the top of the repo. example

    var staticServer = await docker.createContainer({
      Hostname: 'static',
      Image: 'node',
      Cmd: ['node', '/adapter/node_modules/.bin/httpster', '-d', '/static'],
      HostConfig: {
        AutoRemove: true,
        Binds: [
          `${projectRoot}:/adapter`,
          `${tempStaticDir}:/static`
        ]
      },
      ExposedPorts: {
        '3333/tcp': {}
      },
      NetworkingConfig: {
        EndpointsConfig: {
          [networkName]: {
            Aliases: [
              'static'
            ]
          }
        }
      }
    })
Was this page helpful?
0 / 5 - 0 ratings