open-port: command not found

Andrew Wilkins andrew.wilkins at
Mon Oct 23 01:58:59 UTC 2017

On Mon, Oct 23, 2017 at 4:20 AM Akshat Jiwan Sharma <akshatjiwan at>

> HI,
> I'm trying to manually expose a port on a juju machine. According to this
> answer
> <>
> I should be able to do something like this:-
>  juju run  "open-port 443" --all
> However when I type this in my shell it throws an error
> open-port: command not found

The different between the command you're running, and the one on AskUbuntu,
is that you're not passing --unit. When you pass --unit, it runs the
command in the context of a unit on the machine. You must be running in the
context of a unit to use "hook tools", such as open-port.

I can verify that the application on this particular controller is already
> exposed and it thus satisfies the requirement for running this command.
> >"The port range will only be open while the application is exposed."
> Can you help me understand what I'm doing wrong?

Ports are managed on a per-unit basis, so you need to execute the "run"
command against a unit or application, using --unit or --application

Once you've run open-port, you'll need to run "juju expose <application>"
for the ports to actually be opened up.

> Akshat
> --
> Juju mailing list
> Juju at
> Modify settings or unsubscribe at:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Juju mailing list