Running Julia in a Docker container on Azure

Hi,

I have been working with Julia for a while now under Windows on a local machine. Now, I want to deploy some code to Azure and my team has decided to try the official Julia docker repository.

First, the official Docker repo is Linux. That should be manageable for me (I hope!). Starting with the official docker repo, I was able to get my package to run locally, but it requires some manual intervention. For example, I need to run the image and type using MyPackage in the REPL.

To deploy this to Azure, I need some way to not only run Julia automatically, but also execute using MyPackage somehow.

Any ideas? Thank you :pray:

First part is done:

$julia -i -e "using MyPackage"

Yay! :tada:

From here, I am fairly confident we’ll be able to deploy it to Azure :muscle: Sorry for the noob question :sweat_smile:

Update:

The docker is deployed and the Julia command runs as desired, but I think Azure does not like the -i part. It looks like the container exits when the REPL appears.

We are running a server in MyPackage. Is there a way to run Julia and the server in the background without a REPL?

We originally tried

$ julia -e "using MyPackage"

and the server just disappears when it finishes executing :thinking:

Update 2: I realize I was running the server using @async. Finger’s crossed :pray:

1 Like

I am not so sure specifically about Azure, but normally when you want an interactive session, you need to have docker run --interactive --tty julia:latest in your terminal to run, in this case, the latest Julia image in interactive mode. The --tty switch allocates a pseudo terminal under your container, and the --interactive switch makes the container persist.

Have you tried this, or is there an option on Azure for this?

Hi @aytekinar,

Thanks for your response. We don’t actually need the interactive REPL but that was just one way I could think of to keep the script from immediately exiting.

In the end, we got it to work. It turns out the problem was that my method to start the server was @async so running Julia + script from the command line exited immediately. Removing the @async worked and we successfully deployed to Azure. Yay! :tada:

Hi @anon67531922,

You may find this project useful: https://github.com/gsd-ufal/Infra.jl

It is a Julia interface to launch cloud workers on top of Azure VMs.

If you may want to contribute to making it run on Julia 1.0, please contact Raphael Ribeiro raphaelpr01@gmail.com to help you.

Best,

André Lage.

1 Like