Kaydet (Commit) 064330f7 authored tarafından Hakkı Dizdar's avatar Hakkı Dizdar

Yeni Konteyner açılması için gerekli geliştirmeler yapıldı

üst c59f8a34
const Docker = require("dockerode");
const docker = new Docker();
const start = async (image, res) => {
const port = Math.floor(Math.random() * (55000 - 50000) + 50000).toString();
docker.createContainer(
{
Image: image,
AttachStdin: false,
AttachStdout: true,
AttachStderr: true,
HostConfig: {
AutoRemove: true,
ShmSize: 2000000000,
PortBindings: {
"5900/tcp": [
{
HostIp: "",
HostPort: port,
},
],
},
},
},
function (err, container) {
container.start();
res.json({ id: container.id, port: port });
}
);
};
module.exports = start;
......@@ -24,6 +24,10 @@ app.get("/images", (_, res) => {
});
});
app.post("/create", (req, res) => {
require("./docker/controllers/create")(req.body.image, res);
});
require("./socket")(app);
app.listen(3000);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment