Docker : Database is uninitialized and superuser password is not specified - docker

Am new to docker, started learning today.
I am using Windows Terminal to run the docker command.
I ran this command - docker run postgres:10.20
Got an error stating -
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD to a non-empty value for the
superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
connections without a password. This is *not* recommended.
See PostgreSQL documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html
Can anybody help me on how to add password to that command in the Terminal, Apart from running an environment to add password in docker-compose.yaml.
Am beginner to stack overflow as well and was not allowed to add image to provide a reference. Assistance needed

All you need to do is:
docker run -e POSTGRES_PASSWORD=password postgres:10.20
Here is the documentation for setting environment variables for docker run: https://docs.docker.com/engine/reference/run/#env-environment-variables

Related

How to reset couchbase docker container password

I have installed 3 couchbase nodes of docker containers. After a couple of weeks when i tried to log in i could not remember my admin password. After a research i can not find a way to reset password. I am a newcomer to docker world so maybe i missed something. There is a source below but i believe that does not compromise my problem. How can i reset admin password ?
source
The only way to reset your admin password that I'm aware of is to use couchbase-cli's reset-admin-password option, which must be run locally.
Since you are in docker, one option would be to execute bash inside of Docker, and run couchbase-cli there. For instance:
docker exec -it db /bin/bash
At that point, you should have a bash prompt, and you can run couchbase-cli there.
I found a solution and wanted to share you all. After i clicked docker dashboard via docker gui i went for the container's bash then executed codes below.
couchbase-cli reset-admin-password --new-password 123456
Above Mr. Matthew clues us in with a more sophisticated way of going for container's bash.

How to avoid authentication when connecting to standalone chrome debug container?

I am using selenium/standalone-chrome-debug.
By default connecting to the container via VNC will trigger an authentication prompt which can be avoided by setting an environment variable as per the documentation:
If you want to run VNC without password authentication you can set the environment variable VNC_NO_PASSWORD=1.
When I start the container with the following command, I'm still prompted for the password:
docker run -d -p 4444:4444 -p 0:5900 -v /dev/shm:/dev/shm -e VNC_NO_PASSWORD=1 selenium/standalone-chrome-debug
As you can see in the following screencast:
I'm still asked for a password
Trying to authenticate without password fails
When I use the default password (secret), it passes
Question: how do I avoid authentication completely?
Adding
VNC_NO_PASSWORD: 1
to the environment of the relevant service in docker-compose.yml worked for me.

Permission denied for docker-compose Superset

I am trying to get the Superset running on ubuntu server. I have referenced the steps from Superset page as below:
git clone https://github.com/apache/incubator-superset/
cd incubator-superset/contrib/docker
# prefix with SUPERSET_LOAD_EXAMPLES=yes to load examples:
docker-compose run --rm superset ./docker-init.sh
# you can run this command everytime you need to start superset now:
docker-compose up
I have fixed the initial issues around right version of docker-compose and postgress address bind issue on port 5432. So after fixing those my docker compose run command
docker-compose run --rm superset ./docker-init.sh
works fine and it asks me to set up a user name and password.
Finally to get the container running I run the final command
docker-compose up.
On my mac, it would run redis, postrgre container and then give me a localhost:8088 for me to get access to Superset UI with login info.
However on Ubuntu, when I run that, I first get this:
So looks it is running redis and postgres containers fine.
But then it is giving me Permission denied errors to create some mkdir directory.
Pls note I am running it as root user.
Also, my docker compose version is fine with 1.23.2 and my docker along with docker-compose is installed under
/usr/bin/docker and not /usr/local/bin/docker.
But I think that shouldn't be an issue.
Any help where it is going wrong and how can I fix it?
Thanks
Edit:
Ok I looked at the same issue mentioned on Github. And used a suggestion of using it only for Production and not development in docker-compose.yml file.
It seems to not throw the same error now when I do
docker-compose up.
However when I open localhost:8088 it does not connect to the UI.
try this:
mkdir ../../assets
chmod -R 777 ../../superset/assets/
as set in docker-compose.yml#L64, it is using ../../superset as volume when in develop. However the container does not have any permission in the host so the solution is to make a directory by yourself and grant the necessary permissions on to it.

Change environment variables at docker container restart time

I have a docker container with a environment variable that I want to change on restart time. I have read about the -e option that can be used for that in docker run command (described for instance here).
I have tried to use it with restart:
sudo docker restart 1db2df40d98c -e FOOBAR_VERSION='v1'
However, I get this error:
unknown shorthand flag: 'e' in -e
See 'docker restart --help'.
I have also read about re-building the container with the new environment variable value. However, I'd like to avoid so overhelming alterantive. I just want to restart the container, but with a different environment variable value at starting time.
Any hint/reference/help regarding this problem is really welcome, please.
EDIT: I have also tried doing the restart in two steps, I mean:
sudo docker stop 1db2df40d98c
sudo docker start 1db2df40d98c -e FOOBAR_VERSION='v1'
But the result is the same.

How to enable Redmines 'adding of issues' when using Docker?

I have the official postgres image running as a docker container, as well as the official redmine 3.3.1 container linked to the postgres container. All my data is being persisted and Redmine appears to be working fine, with one exception.
I have no way of adding issues within Redmine. I have the modules enabled and my user has manager, dev, and reporter roles and perms. I've also added admin to the user, but still a no go.
I suspect this problem has something to do with using Docker containers since I don't have the issue when running directly on the file system (no containers).
Thoughts?
Edit: (adding commands)
docker run -d --name postgres \
-v /home/me/redmine/postgresql:/var/lib/postgresql/data \
-e POSTGRES_DB=redmine \
-e POSTGRES_USER=redmine \
-e POSTGRES_PASSWORD=secret postgres
docker run -d -p 3000:3000 --name redmine \
-v /home/me/redmine/files:/usr/src/redmine/files \
--link postgres:postgres redmine
Redmine has no notion of the underlying infrastructure, so if the "new issue" button isn't shown, that has nothing to do with missing write permissions on the file system or database level, for instance.
If you can login, then your Redmine has already successfully performed database UPDATEs, and creating an issue does not need anything else, so you'd be looking in the wrong place when checking your Docker config.
I am almost certain you're missing permissions or a default configuration (e.g. issue statuses, issue priorities, roles, trackers, workflows, etc.), as mentioned in my comment above.
I am assuming you don't have any relevant data yet in your Redmine database. If that's the case, please try the following.
WARNING: This deletes all Redmine data.
export RAILS_ENV=production - set the environment assuming that your Docker image is built for a production Redmine, otherwise try development.
bundle exec rake db:drop - delete the database
bundle exec rake db:create - recreate an empty database
bundle exec rake db:migrate - recreate the schema
bundle exec rake redmine:load_default_data - this is the crucial part which I suspect has been missed last time, it creates all necessary objects required to successfully work with your Redmine, e.g. create issues!

Resources