Permission denied for docker-compose Superset - docker

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.

Related

Docker desktop install in container fails on /etc/hosts .. what do to?

I am trying to install docker engine inside a container.
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-4.16.2-amd64.deb
apt-get install -y ./docker-desktop-4.16.2-amd64.deb
Everything goes fine until in the post install phase, it tries to update /ect/hosts files for the kubernetes. Here it fails:
/var/lib/dpkg/info/docker-desktop.postinst: line 42: /etc/hosts: Read-only file system
This is expected behaviour for docker build in that it does not allow to modify /etc/hosts of the container.
Is there a way to solve this? Install docker desktop without doing this step? Or any other way?
I Solved this issue by adding this parameter in build
--add-host kubernetes.docker.internal:127.0.0.1
Example:
docker build --add-host kubernetes.docker.internal:127.0.0.1 -t stsjava2 .
When the Docker desktop installation fails with an error related to "/etc/hosts", it is usually due to a conflict with the host system's configuration. Here are some steps that you can try to resolve the issue:
Check the permissions of the "/etc/hosts" file on your host system to ensure
that it is accessible to Docker.
Try to start the Docker container with elevated privileges (e.g., using
"sudo") to see if that resolves the issue.
If the above steps do not resolve the issue, you can try modifying the
Docker container's network configuration to use a different network driver
that does not conflict with the host system's "/etc/hosts" file.
You can also try running the Docker container in a different environment
(e.g., a virtual machine) that does not have the same conflicts with the
host system.
If all else fails, you can try reinstalling Docker or using a different version of Docker to see if that resolves the issue.

Docker/Ansible: ERROR! The playbook could not be found

I'm quite new to software development and having some issues setting up a docker container.
I've pull the docker container and run it. Now I want to apply some configuration to my container with
docker run --rm --network="ansible_default" -v C:\folder\folder1\ansible\playbooks:/ansible/playbooks docker.<address>/ansible ansible-playbook -i host localhost.playbook.yml
But when I run the above code, it just gives an error:
ERROR the playbook localhost.playbook.yml does not appear to be a file
I am running on administration powershell and have cd into the folder that contains the yaml files. (so inside C:\folder\folder1\ansible\playbooks)
Do I need ansible installed? Any pointers would be greatly appreciated!
EDIT: The docker container exits with a code 2, I'm supposed to be able to access it via localhost:8080 but it's just a blank screen. Exited(2) I'm not too sure what it means, haven't found much success online.
Turns out the solution is to reinstall Docker.

How can I solve 403:Forbidden whilst using a docker container?

I'm new to Docker and currently following this tutorial:
Learn Docker in 12 minutes
I created the necessary files and I made it up to display "Hello World!" on localhost:80.
Beyond that point, I tried to mount the container using the direct reference to my folder so I can update the index.php file to mimic the development evironment, and then I come with this error:
All I did is change the way the image is ran so I can update the content of the index.php file and see the changes reflect in the webpage when I hit F5.
Currently using Docker for Windows on Windows 10 Pro
Docker for Windows is running
I followed every steps scrupulously so I don't get myself fooled and it didn't work for me it seems.
To answer Mornor's question, here is the result for docker ps
And here for docker logs [container-name]
And since I now better understand what happens under the hood, how do I go to solve my problem illustrated in the log?
Here is my Dockfile
And the command I executed to run my image:
docker run -p 80:80 -v /wmi/tutorials/docker/src/:/var/www/html/ hello-world
And so you see that the file exists:
Error is coming from Apache which tries to show you the directory contents as there is no index file available. Either your docker mapping is not working correctly, or your apache does not have php support installed on it. You are accessing http://localhost, try http://localhost/index.php.
If you get same error, problem is with mapping. If you get php code the problem is with missing PHP support in Apache.
I think you're wrongly mouting your index.php. What you could do to debug it, is to firstly check if the index.php is indeed mounted within the container.
You could issue the following command :
docker run -p 80:80 -v /wmi/tutorials/docker/src/:/var/www/html/ hello-world bash -c 'ls -lsh /var/www/html/'
(use sh instead of bash if it does not work). If you can indeed see a index.php, then congratulations your file is correctly mounted, and the error is not coming from Docker, but from Apache.
If index.php is not there, then you have to check your Dockerfile. You mount src/, check if /src is in the same directory as your Dockerfile.
Keep us updated :)
I know the answer is late but the answer is very easy:
this happens When using docker and you have SELinux, be aware that the host has no knowledge of container SELinux policy.
by adding z
docker run -p 80:80 -v /wmi/tutorials/docker/src/:/var/www/html/:z hello-world
this will automatically do the chcon .... that you need to do.
Check whether the html folder has the proper permission or not.
Thank you

My app can't create log files when it starts up inside Docker

I spent the weekend pouring over the Docker docs and playing around with the toy applications and example projects. I'm now trying to write a super-simple web service of my own and run it from inside a container. In the container, I want my app (a Spring Boot app under the hood) -- called bootup -- to have the following directory structure:
/opt/
bootup/
bin/
bootup.jar ==> the app
logs/
bootup.log ==> log file; GETS CREATED BY THE APP # STARTUP
config/
application.yml ==> app config file
logback.groovy ==> log config file
It's very important to note that when I run my app locally on my host machine - outside of Docker - everything works perfectly fine, including the creation of log files to my host's /opt/bootup/logs directory. The app endpoints serve up the correct content, etc. All is well and dandy.
So I created the following Dockerfile:
FROM openjdk:8
RUN mkdir /opt/bootup
RUN mkdir /opt/bootup/logs
RUN mkdir /opt/bootup/config
RUN mkdir /opt/bootup/bin
ADD build/libs/bootup.jar /opt/bootup/bin
ADD application.yml /opt/bootup/config
ADD logback.groovy /opt/bootup/config
WORKDIR /opt/bootup/bin
EXPOSE 9200
ENTRYPOINT java -Dspring.config=/opt/bootup/config -jar bootup.jar
I then build my image via:
docker build -t bootup .
I then run my container:
docker run -it -p 9200:9200 -d --name bootup bootup
I run docker ps:
CONTAINER ID IMAGE COMMAND ...
3f1492790397 bootup "/bin/sh -c 'java ..."
So far, so good!
My app should then be serving a simple web page at localhost:9200, so I open my browser to http://localhost:9200 and I get nothing.
When I use docker exec -it 3f1492790397 bash to "ssh" into my container, I see everything looks fine, except the /opt/bootup/logs directory, which should have a bootup.log file in it -- created at startup -- is instead empty.
I tried using docker attach 3f1492790397 and then hitting http://localhost:9200 in my browser, to see if that would generated some standard output (my app logs both to /opt/bootup/logs/bootup.log as well as the console) but that doesn't yield any output.
So I think what's happening is that my app (for some reason) doesn't have permission to create its own log file when the container starts up, and puts the app in a weird state, or even prevents it from starting up altogether.
So I ask:
Is there a way to see what user my app is starting up as?; or
Is there a way to tail standard output while the container is starting? Attaching after startup doesn't help me because I think by the time I run the docker attach command the app has already choked
Thanks in advance!
I don't know why your app isn't working, but can answer your questions-
Is there a way to see what user my app is starting up as?; or
A: Docker containers run as root unless otherwise specified.
Is there a way to tail standard output while the container is starting? Attaching after startup doesn't help me because I think by the time I run the docker attach command the app has already choked
A: Docker containers dump stdout/stderr to the Docker logs by default. There are two ways to see these- 1 is to run the container with the flag -it instead of -d to get an interactive session that will list the stdout from your container. The other is to use the docker logs *container_name* command on a running or stopped container.
docker attach 3f1492790397
This doesn't do what you are hoping for. What you want is docker exec (probably docker exec -it bootup bash), which will give you a shell in the scope of the container which will let you check for your log files or try and hit the app using curl from inside the container.
Why do I get no output?
Hard to say without the info from the earlier commands. Is your app listening on 0.0.0.0 or on localhost (your laptop browser will look like an external machine to the container)? Does your app require a supervisor process that isn't running? Does it require some other JAR files that are on the CLASSPATH on your laptop but not in the container? Are you running docker using Docker-Machine (in which case localhost is probably not the name of the container)?

Always ask password on local file when modified file when ran docker container

I'm newbie in docker. And i tried to create a Dockerfile to run a website was written byrails, postgresql on apache+passenger.
But when i run Dockerfile, it run successfully, but it had a problem with permission denied. I found problem that folder web must belongs to apache user. Then i tried to change apache user to source web (on container). And it run ok.
But every time i modified a file on local. It always ask password when i saved this file.
And i checked permission source on local. It changed all role to weird role.
How can i solved this problem ?
This is my Dockerfile.
And i used two commands to run.
docker build -t wics .
docker run -v /home/khanhpn/Project/wics:/home/abc -p 80:80 -it wics /bin/bash
After a mount of time, i found a solution to solve this problem.
I just add this line in Dockerfile, the problem was solved.
RUN usermod -u 1000 apache

Resources