You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
It is not clear how to pass params to match with 'docker run' command:
how to pass port mappings, '--shm-size' etc. Please add some examples on it.
The text was updated successfully, but these errors were encountered:
It's worth noting that while the docker CLI supports docker run ..., the engine requires you to first create a container (where you would specify your options), and then start that container.
For example, you could start a mysql container on port 3306 with a shm size of 128MB using the following code:
const{ Docker }=require('node-docker-api');constdocker=newDocker({socketPath: '/var/run/docker.sock'});docker.container.create({name: 'mysql',// equivalent to --name=mysql for `docker run`Image: 'mysql:5.7.19',Env: ['MYSQL_ROOT_PASSWORD=rootpassword','MYSQL_DATABASE=example_database'],// Boilerplate for mysqlHostConfig: {PortBindings: {'3306/tcp': [{HostIp: '0.0.0.0',HostPort: '3306'// Bind the container to port 3306 on the host}]},ShmSize: 128000000// Set the shm size to 128MB}}).then(container=>container.start());
Note: If you do not have the mysql:5.7.19 image locally, you must first pull it with docker pull mysql:5.7.19
Hi!
It is not clear how to pass params to match with 'docker run' command:
how to pass port mappings, '--shm-size' etc. Please add some examples on it.
The text was updated successfully, but these errors were encountered: