mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +00:00
Allow pulling images too
This commit is contained in:
parent
3d2f3ad94b
commit
5d822b8dab
@ -244,16 +244,19 @@ do ->
|
||||
|
||||
exports.createImage = (req, res) ->
|
||||
{ registry, repo, tag, fromImage, fromSrc } = req.query
|
||||
if fromImage
|
||||
if fromImage?
|
||||
repoTag = fromImage
|
||||
else
|
||||
repoTag = buildRepoTag(repo, tag, registry)
|
||||
Promise.using lockImages(), ->
|
||||
knex('image').insert({ repoTag })
|
||||
.then ->
|
||||
docker.importImageAsync(req, { repo, tag, registry })
|
||||
.then (stream) ->
|
||||
stream.pipe(res)
|
||||
if fromImage?
|
||||
docker.createImageAsync({ fromImage })
|
||||
else
|
||||
docker.importImageAsync(req, { repo, tag, registry })
|
||||
.then (stream) ->
|
||||
stream.pipe(res)
|
||||
.catch (err) ->
|
||||
res.status(500).send(err?.message or err or 'Unknown error')
|
||||
|
||||
@ -302,21 +305,21 @@ do ->
|
||||
exports.startContainer = (req, res) ->
|
||||
docker.getContainer(req.params.id).startAsync(req.body)
|
||||
.then (data) ->
|
||||
res.json(data)
|
||||
res.json(data)
|
||||
.catch (err) ->
|
||||
res.status(500).send(err?.message or err or 'Unknown error')
|
||||
|
||||
exports.stopContainer = (req, res) ->
|
||||
docker.getContainer(req.params.id).stopAsync(sanitizeQuery(req.query))
|
||||
.then (data) ->
|
||||
res.json(data)
|
||||
res.json(data)
|
||||
.catch (err) ->
|
||||
res.status(500).send(err?.message or err or 'Unknown error')
|
||||
|
||||
exports.deleteContainer = (req, res) ->
|
||||
docker.getContainer(req.params.id).removeAsync(sanitizeQuery(req.query))
|
||||
.then (data) ->
|
||||
res.json(data)
|
||||
res.json(data)
|
||||
.catch (err) ->
|
||||
res.status(500).send(err?.message or err or 'Unknown error')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user