itsyub
itsyub

Reputation: 113

Can I directly deploy generated docker image without pushing it to DockerHub?

I don't want to push a docker build image to DockerHub. Is there any way to directly deploy a docker image from CircleCI to AWS/vps/vultr without having to push it to DockerHub?

Upvotes: 2

Views: 696

Answers (3)

Disclaimer: I am the author of Dogger.

I made a blog post about it here, which allows just that: https://medium.com/@mathiaslykkegaardlorenzen/hosting-a-docker-app-without-pushing-an-image-d4503de37b89

Upvotes: 1

i.bondarenko
i.bondarenko

Reputation: 3572

I use docker save/load commands:

# save image to tar locally
docker save -o ./image.tar $IMAGEID
# copy to target host
scp ./image.tar user@host:~/
# load into target docker repo
ssh user@host "docker load -i ~/image.tar"
# tag the loaded target image
ssh user@host "docker tag $LOADED_IMAGE_ID myimage:latest"

PS: LOADED_IMAGE_ID can be retrieved in following way:

REMOTE_IMAGE_ID=`ssh user@host"docker load -i ~/image.tar" | grep -o "sha256:.*"`

Update: You can gzip output to make it smaller. (Don't forget unzip the image archive before load)

docker save $IMAGEID | gzip > image.tar.gz

Upvotes: 4

dschuldt
dschuldt

Reputation: 657

You could setup your own registry: https://docs.docker.com/registry/deploying/

Edit: As i.bondarenko said, docker save/load are the better commands for your needs.

Upvotes: 1

Related Questions