mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
Reuse container by name
This commit is contained in:
1 parent
e3d66709e4
commit
df12fee39c
2 files changed
+11
-7
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
||||
import express from 'express'
|
||||
import http from 'http'
|
||||
import { Server } from 'socket.io'
|
||||
import { createContainer, attachContainer } from './docker.js'
|
||||
import { getOrCreateContainer, attachContainer } from './docker.js'
|
||||
|
||||
const app = express()
|
||||
const server = http.createServer(app)
|
||||
@@ -9,7 +9,7 @@ const io = new Server(server)
|
||||
|
||||
io.on('connection', async (socket) => {
|
||||
console.log('Connected to the client.')
|
||||
const container = await createContainer()
|
||||
const container = await getOrCreateContainer('odyssey-test')
|
||||
const stream = await attachContainer(container)
|
||||
|
||||
stream.on('data', (chunk) => {
|
||||
|
||||
Reference in new issue
Block a user