Launching a InfluxDB container in docker with a default database name - docker

I'm running the following command to launch a InfluxDB container. This should create a new databse with the name defaultdb.
docker run -p 8086:8086 \
-e INFLUXDB_DB=defaultdb -e INFLUXDB_ADMIN_ENABLED=true \
-e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=adminpass \
-e INFLUXDB_USER=user -e INFLUXDB_USER_PASSWORD=userpass \
-v influxdb:/var/lib/influxdb \
influxdb:latest
But it doesnt create the default databse defaultdb. It creates the databse db0 instead of defaultdb. What I'm doing wrong?
https://hub.docker.com/_/influxdb/
Thanks in advance.

The problem is probably comming from the volume.
-v influxdb:/var/lib/influxdb
In particular, if you have previously created a database using the same command but without specifying the INFLUXDB_DB=defaultdb, this old database is overriding the container data via the old volume.
To solve the issue, remove the old volume and rerun the command:
docker volume rm influxdb

The issue was due to the INFLUXDB_ADMIN_ENABLED=true line.
The documentation states:
The administrator interface is deprecated as of 1.1.0 and will be
removed in 1.3.0.
I was using the latest version which is (currently) the 1.4 so it seems that there was a problem with that deprecated INFLUXDB_ADMIN_ENABLED variable.
Removing that line, everything worked perfectly.
docker run -p 8086:8086 \
-e INFLUXDB_DB=defaultdb \
-e INFLUXDB_ADMIN_USER=admin \
-e INFLUXDB_ADMIN_PASSWORD=adminpass \
-e INFLUXDB_USER=user \
-e INFLUXDB_USER_PASSWORD=userpass \
-v influxdb:/var/lib/influxdb \
influxdb:latest

Related

starting a NIFI container with my template/flow automatically loaded

i want to create a NIFI container and pass it a template/flow to be loaded automatically when the container is being created (without human intervention).
couldn't find any volumes/environments that are related to it.
i tried using (suggested by chatGPT):
docker run -d -p 8443:8443 \
-v /path/to/templates:/templates \
-e TEMPLATE_FILE_PATH=/templates/template.xml \
--name nifi apache/nifi
and
docker run -d -p 8443:8443 \
-e NIFI_INIT_FLOW_FILE=/Users/l1/Desktop/kaleidoo/devops/files/git_aliases/flow.json \
-v /Users/l1/Desktop/kaleidoo/docker/test-envs/flow.json:/flow.json:ro \
--name nifi apache/nifi
non of them worked, and i couldn't find data about NIFI_INIT_FLOW_FILE and TEMPLATE_FILE_PATH in the documentation.

How to start docker with nominatim

I started docker with this command:
docker run -it --shm-size=4g \
-e PBF_URL=https://download.geofabrik.de/north-america/us-latest.osm.pbf \
-e REPLICATION_URL=https://download.geofabrik.de/north-america/us-updates/ \
-e IMPORT_US_POSTCODES=true \
-e IMPORT_TIGER_ADDRESSES=true \
-e IMPORT_WIKIPEDIA=/nominatim/extras/wikimedia-importance.sql.gz \
-p 8080:8080 \
-v /osm-maps/extras:/nominatim/extras \
--name nominatim \
mediagis/nominatim:4.0
It takes quite some time to load the data.. When I do docker images I see this:
REPOSITORY TAG IMAGE ID CREATED SIZE
mediagis/nominatim 4.0 3097bc96440b 3 weeks ago 875MB
For some reason I woke up this morning and the box I had this running on was off.. I really hope I don't have to reload all the data again.. Is there a way to start this back up without reloading data?

Enable fine grained on keycloak with docker

I have set up keycloak using docker, my problem is that I need to do some modifications on the clients that need the fine grained to be enabled. I have read the documentation and i know I should use the parameter -Dkeycloak.profile=preview or -Dkeycloak.profile.feature.admin_fine_grained_authz=enabled. My problem is that I tried to use that on my docker execution command, but with no luck
docker run --rm \
--name keycloak \
-p 80:8080 \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=[adminPass] \
-e PROXY_ADDRESS_FORWARDING=true \
-e DB_VENDOR=MYSQL \
-e DB_ADDR=[SQL_Server] \
-e DB_DATABASE=keycloak \
-e DB_USER=[DBUSER] \
-e DB_PASSWORD=[DB_PASS] \
-e JDBC_PARAMS=useSSL=false \
-e -Dkeycloak.profile.feature.admin_fine_grained_authz=enabled \
jboss/keycloak
any help?
It is documented in the Docker image readme https://hub.docker.com/r/jboss/keycloak
Additional server startup options (extension of JAVA_OPTS) can be configured using the JAVA_OPTS_APPEND environment variable.
So in your case:
-e JAVA_OPTS_APPEND="-Dkeycloak.profile=preview"
Guess you might need to pass the environment variables to the JVM when starting the Wildfly containing the Keycloak WAR. There is a runner shell script that starts when launching the container. You need to add your environment variables to that call.

Docker container as default application

I have Firefox nightly running in a container. I'm looking for a solution to configure it as my default browser application(ubuntu 18.04).
So my question is, how to configure a Docker container as default system application in Ubuntu.
My docker command is:
docker run -d --net=host -v ~/:/home/firefox -v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix:0 -v /dev/shm:/dev/shm --device /dev/snd \
--group-add 29 -e PULSE_SERVER=unix:/run/user/1000/pulse/native \
-v /run/user/1000/pulse/native:/run/user/1000/pulse/native \
firefox-nightly
I suppose I must create a new mime file, but not sure how to do it, to be able to create the container with all these parameters.
Thanks
One alternative is to create a new .desktop file (e.g: /usr/share/applications/firefox-docker.desktop).
I just copied the existing firefox.desktop and changed Exec sections with the command using docker (*)
Then use xdg-utils (**) configure it as default browser application:
xdg-settings set default-web-browser firefox-docker.desktop.
*: To keep the .desktop file cleaner, you could create an executable file in system PATH (e.g: /usr/bin): docker-firefox:
xhost +
docker run --net=host -v ~/:/home/firefox -v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix:0 -v /dev/shm:/dev/shm --device /dev/snd \
--group-add 29 -e PULSE_SERVER=unix:/run/user/1000/pulse/native \
-v /run/user/1000/pulse/native:/run/user/1000/pulse/native \
firefox-nightly $#
Note the $# at the end. And make it executable so it can be executed as a normal application.
**: The link is from Arch documentation, but it works in Ubuntu as well.

owncloud - docker - location of data and mysql data directories on the host?

I'm installing the owncloud server on a macOS machine, so I have to use the docker image. The docker installation documentation says the install:
mounts the data and MySQL data directories on the host for persistent storage
But I cannot find the location.
The docker-composer.yml file mentions
services:
owncloud:
volumes:
- files:/mnt/data
but this is not a path on my host, so obviously I'm missing something.
Thanks,
In your case, location of your data is "files".
In following case, location of data is "/var/mysql/data" :
services:
owncloud:
volumes:
- /var/mysql/data:/mnt/data
Editing the OwnCloud docker-compose.yml file to add a bind mount point didn't work for me at all. It seemed to work only for the first container run and then on subsequent runs I was getting errors suggesting that the database couldn't start.
I ended up finding it a lot easier to have the database stored on the host, disabling redis and using a bind mount for the file storage so I could be assured that I'd always get a reliable state when the container got restarted/removed/etc.
export OWNCLOUD_VERSION=10.5.0
export OWNCLOUD_DOMAIN=localhost
export ADMIN_USERNAME=***
export ADMIN_PASSWORD=***
export HTTP_PORT=8080
docker run -d \
--net host \
--name owncloud \
-p ${HTTP_PORT}:8080 \
-e OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN} \
-e OWNCLOUD_DB_TYPE=pgsql \
-e OWNCLOUD_DB_NAME=owncloud \
-e OWNCLOUD_DB_USERNAME=*** \
-e OWNCLOUD_DB_PASSWORD=*** \
-e OWNCLOUD_DB_HOST=localhost \
-e OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME} \
-e OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD} \
-e OWNCLOUD_REDIS_ENABLED=false \
-e OWNCLOUD_REDIS_HOST=redis \
-v /blah/data:/mnt/data:rw \
owncloud/server:${OWNCLOUD_VERSION}
This code is also nifty to simply place in your system startup file and bang - it all just works.

Resources