# Running Julia in a Docker container on Azure

**URL:** https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240
**Category:** General Usage
**Created:** [January 9, 2018, 3:49am UTC](https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240 "2018-01-09T03:49:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anon67531922](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon67531922](https://discourse.julialang.org/u/anon67531922)
#### Post date: [January 9, 2018, 3:49am UTC](https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240/1 "2018-01-09T03:49:25Z")

</div>

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](https://hub.docker.com/_/julia/).

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 🙏

---

<div class="post-metadata">

### Author: ![anon67531922](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon67531922](https://discourse.julialang.org/u/anon67531922)
#### Post date: [January 9, 2018, 4:27am UTC](https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240/2 "2018-01-09T04:27:51Z")

</div>

First part is done:

```julia
$julia -i -e "using MyPackage"

```

Yay! 🎉

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

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
$ julia -e "using MyPackage"

```

and the server just disappears when it finishes executing 🤔

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

---

<div class="post-metadata">

### Author: ![anon61610682](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@anon61610682](https://discourse.julialang.org/u/anon61610682)
#### Post date: [January 9, 2018, 9:11am UTC](https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240/3 "2018-01-09T09:11:33Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![anon67531922](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon67531922](https://discourse.julialang.org/u/anon67531922)
#### Post date: [January 9, 2018, 12:11pm UTC](https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240/4 "2018-01-09T12:11:40Z")

</div>

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! 🎉

---

<div class="post-metadata">

### Author: ![lage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lage/32/2085_2.png) [@lage](https://discourse.julialang.org/u/lage)
#### Post date: [September 9, 2018, 2:58pm UTC](https://discourse.julialang.org/t/running-julia-in-a-docker-container-on-azure/8240/5 "2018-09-09T14:58:38Z")

</div>

Hi @anon67531922,

You may find this project useful: [https://github.com/gsd-ufal/Infra.jl](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](mailto:raphaelpr01@gmail.com) to help you.

Best,

André Lage.
