How to directly deploy a container via ssh?

Hi all!

I’m very new to DroneCI, actually, to the whole “DevOps”-stuff. I’m running a Finnish website for stormchasers since 2007 and I thought, after 14 years of Joomla, it’s time to modernize. So at the moment, I’m learning-by-doing Javascript, NodeJS, webapp development, Docker, … all at the same time.
I just recently stumbled over DroneCI through a YouTube video and it looked very interesting. At the moment, I’m using bash scripts to build and update my container. The building I got already running in DroneCI but I’m a bit stuck with the deployment. Trouble - or not - is that I’m not using a registry. I havent found any easy to deploy self-hosted registry yet and I’m not sure if deploying one just for that one website project would be worth the effort. I don’t really want to use a public registry because my website code is not open source.
So, at the moment, I’m directly deploying through ssh like this:

docker save container:latest | bzip2 | pv | ssh user@webserver 'bunzip2 | sudo docker load'

Would there be any way to do this with DroneCI?

Greetings and thanks in advance!
Stefan

Hello Stefan,

You can use Docker plugin and can configure registry and repo accordingly as mentioned in below doc:

Example configuration using a custom registry:
steps:
- name: docker
image: plugins/docker
settings:
username: kevinbacon
password: pa55word
repo: index.company.com/foo/bar
registry: index.company.com

https://docs.drone.io/plugins/popular/docker/

Regards,
Harness Support

Hi,

thanks but as I wrote, I’m explicitly not using any registry. I’m deploying the image directly through docker save / docker load via an SSH pipe.

-Stefan

@sgofferj how would you deploy an image directly through docker save / docker load via ssh on your laptop? Likely you would write a shell script. You can take this same approach in Drone.

kind: pipeline
type: docker
name: default

steps:
- name: build
  image: docker
  commands:
  - ./my-shell-script.sh

Note that if you are building docker images you may need to mount the host machine docker socket as shown in this example: Docker | Drone

1 Like

OK, I’ll try that! Thanks :slight_smile:

Have to jump through a few hoops for ssh public key auth but it works great.
One thing though: the command has to be
- sh buildscript.sh
Apparently GIT doesn’t sync executable bits, so just calling the script’s name doesn’t work.