Editing
Troubleshooting of docker errors
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Troubleshooting of docker errors == General Troubleshooting Steps of Docker Errors == === Viewing Docker Logs === Enter the following command <pre> tail /home/dockerd.log </pre> Or the see the log of specific container ID <pre> docker logs <Container ID> # OR enter the following command which the log was updated automatically docker logs -f --details <Container ID> </pre> === Useful Tools === * [https://hadolint.github.io/hadolint/ Dockerfile Linter] == Common Error Solutions == === Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? === Error condition: After I inputted the command {{kbd | key = docker ps}}, I met the error message as follows: <pre> Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? </pre> Solution: * On CentOS: {{kbd | key = sudo systemctl start docker}}<ref>[https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7 How To Install and Use Docker on CentOS 7 | DigitalOcean]</ref> === Error response from daemon: dial unix docker.raw.sock: connect: connection refused (on Mac) === Error condition: After I inputted the command {{kbd | key = docker ps}}, I met the error message as follows: <pre> Error response from daemon: dial unix docker.raw.sock: connect: connection refused </pre> Solution: Make sure the docker is running. After docker was lunched, the result of command {{kbd | key = docker ps}} should be: <pre> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES </pre> === Error response from docker desktop: credential when tried to docker push === Solution: Login the account of docker hub === Error response from docker desktop: denied: requested access to the resource is denied when tried to docker push === Solution: Add tag to the docker image you want to publish<ref>[https://stackoverflow.com/questions/43858398/docker-push-error-denied-requested-access-to-the-resource-is-denied docker push error "denied: requested access to the resource is denied" - Stack Overflow]</ref> <pre> docker tag <IMAGE ID> <ACCOUNT NAME>/<NAME>:<TAG> </pre> === .:/app bind mount allows container to write back to host === Error condition: The <code>.:/app</code> entry in {{kbd|key=docker-compose.yml}} defaults to read-write, meaning processes inside the container can write back to the entire project directory on the host — including <code>.env</code> files containing API keys. If the Streamlit app has a vulnerability that gets exploited, an attacker could use the container to modify arbitrary files on the host. Solution: In the <code>volumes</code> section of <code>docker-compose.yml</code>, append <code>:ro</code> (read-only) to the code directory, and keep only the <code>data</code> directory as read-write: <pre> volumes: - .:/app:ro # source code read-only - ./data:/app/data # data directory remains read-write - ./.env:/app/.env:ro </pre> If the Streamlit app needs to write temporary files outside of <code>/app</code>, grant write access to that specific subdirectory individually — do not remove the top-level <code>:ro</code>. === docker group membership not taking effect — docker ps still shows permission denied === Error condition: After running {{kbd|key=sudo usermod -aG docker your-username}}, subsequent {{kbd|key=docker ps}} still shows the following error: <pre> permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock </pre> Cause: The current SSH session was established before <code>usermod</code> ran. Group membership changes do not apply to existing sessions. Solution: * Confirm the account has been added to the <code>docker</code> group: {{kbd|key=groups your-username}} — output should include <code>docker</code> * Fully log out of SSH and reconnect: {{kbd|key=exit}} * After reconnecting, verify with {{kbd|key=groups}} (should include <code>docker</code>) and {{kbd|key=docker ps}} (should list containers normally) Note: On certain Debian environments, <code>newgrp docker</code> may return <code>Invalid password</code> and refuse to execute even when no password is expected — this is known behaviour. A full SSH reconnect is the correct fix. === Error: This image might run with root as the default user. Make sure it is safe here. === [[Troubleshooting_of_SonarQube_issue#How_to_resolve_"This_image_might_run_with_root_as_the_default_user._Make_sure_it_is_safe_here." | This image might run with root as the default user. Make sure it is safe here]] == References == <references /> {{Template:Troubleshooting}} [[Category: Programming]] [[Category: Docker]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Kbd
(
edit
)
Template:Troubleshooting
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information