mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-27 22:29:31 +08:00
Improve Docker no-auth mode.
Remove use of environment variable, instruct users to run a specific command instead.
This commit is contained in:
@@ -25,12 +25,10 @@ context of a container, this means you would normally need to provide a
|
|||||||
configuration file with your settings.
|
configuration file with your settings.
|
||||||
|
|
||||||
If you wish to run mosquitto without any authentication, and without setting
|
If you wish to run mosquitto without any authentication, and without setting
|
||||||
any other configuration options, you can do so by setting an environment
|
any other configuration options, you can do so by using a configuration
|
||||||
variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will
|
provided in the container for this purpose:
|
||||||
ignore any configuration file you provide.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto:<version>
|
docker run -it -p 1883:1883 eclipse-mosquitto:<version> mosquitto -c /mosquitto-no-auth.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|||||||
@@ -7,11 +7,4 @@ if [ "$user" = '0' ]; then
|
|||||||
[ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true
|
[ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then
|
exec "$@"
|
||||||
# The user wants to run Mosquitto with no authentication, but without
|
|
||||||
# providing a configuration file. Use the pre-provided file for this.
|
|
||||||
exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf
|
|
||||||
else
|
|
||||||
# Execute whatever command is requested
|
|
||||||
exec "$@"
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -25,12 +25,10 @@ context of a container, this means you would normally need to provide a
|
|||||||
configuration file with your settings.
|
configuration file with your settings.
|
||||||
|
|
||||||
If you wish to run mosquitto without any authentication, and without setting
|
If you wish to run mosquitto without any authentication, and without setting
|
||||||
any other configuration options, you can do so by setting an environment
|
any other configuration options, you can do so by using a configuration
|
||||||
variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will
|
provided in the container for this purpose:
|
||||||
ignore any configuration file you provide.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto:<version>
|
docker run -it -p 1883:1883 eclipse-mosquitto:<version> mosquitto -c /mosquitto-no-auth.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|||||||
@@ -7,11 +7,4 @@ if [ "$user" = '0' ]; then
|
|||||||
[ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true
|
[ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then
|
exec "$@"
|
||||||
# The user wants to run Mosquitto with no authentication, but without
|
|
||||||
# providing a configuration file. Use the pre-provided file for this.
|
|
||||||
exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf
|
|
||||||
else
|
|
||||||
# Execute whatever command is requested
|
|
||||||
exec "$@"
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user