# How to run a ruby script inside docker container?

**URL:** <https://meta.discourse.org/t/how-to-run-a-ruby-script-inside-docker-container/67838>\
**Category:** Support\
**Created:** [August 10, 2017, 9:09pm UTC](https://meta.discourse.org/t/how-to-run-a-ruby-script-inside-docker-container/67838 "2017-08-10T21:09:45Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![codechef](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codechef/32/90261_2.png) [@codechef](https://meta.discourse.org/u/codechef)\
**Post date:** [August 10, 2017, 9:09pm UTC](https://meta.discourse.org/t/how-to-run-a-ruby-script-inside-docker-container/67838/1 "2017-08-10T21:09:45Z")

</div>

I have an existing Discourse community with existing users. I added custom user fields that I need to update from an external source. I created and tested a .rb script in a local development environment. I’d now like to run that script against the production instance. Production environment is a self-hosted docker install at Digital Ocean.

I now need help with the following two (N00b) tasks:

1. How do I copy the .rb file into the docker container from the host server?
2. How do I execute the .rb file within the docker container?

I plan to take a backup of the production Discourse just before executing the script incase ‘bad things happen’.

Alternatively, am I better to use backup/restore to execute the script locally, then restore that to production? Just not wild about the downtime required for this approach.

Thanks for the help!

---

_[View the full topic](https://meta.discourse.org/t/how-to-run-a-ruby-script-inside-docker-container/67838)._
