wiki:docker_troubleshooting
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
wiki:docker_troubleshooting [2022/01/21 15:51] – created antisa | wiki:docker_troubleshooting [2025/04/10 12:25] (current) – [Containers lose access to internet suddenly] update docker version antisa | ||
---|---|---|---|
Line 12: | Line 12: | ||
systemctl restart docker.service | systemctl restart docker.service | ||
+ | Or create that chain in filter table | ||
+ | iptables -t filter -N DOCKER-ISOLATION-STAGE-1 | ||
+ | This is [[https:// | ||
+ | |||
+ | |||
+ | ==== Tested on ==== | ||
- | **Tested on** | ||
* Docker 20.10.12 | * Docker 20.10.12 | ||
+ | * Debian 11 | ||
+ | * shorewall 5.2.3.4 | ||
+ | |||
+ | ===== Volume shadowing ===== | ||
+ | This is a tricky behaviour from Docker. Say you have a volume /// | ||
+ | |||
+ | a.txt | ||
+ | b.txt | ||
+ | private/ | ||
+ | private/ | ||
+ | private/ | ||
+ | |||
+ | Your Dockerfile might look like this: | ||
+ | < | ||
+ | FROM python: | ||
+ | |||
+ | # create folders | ||
+ | RUN mkdir -p / | ||
+ | mkdir -p / | ||
+ | mkdir -p / | ||
+ | |||
+ | |||
+ | WORKDIR /app | ||
+ | VOLUME / | ||
+ | |||
+ | </ | ||
+ | |||
+ | When you run this dockerfile everything under the // | ||
+ | mkdir -p / | ||
+ | |||
+ | like so | ||
+ | |||
+ | < | ||
+ | FROM python: | ||
+ | |||
+ | # create folders | ||
+ | RUN mkdir -p / | ||
+ | mkdir -p / | ||
+ | mkdir -p / | ||
+ | mkdir -p / | ||
+ | |||
+ | WORKDIR /app | ||
+ | VOLUME / | ||
+ | |||
+ | </ | ||
+ | When the container builds now there won't be a directory called " | ||
+ | |||
+ | To get around this you will have to create this extra directory on the host and change it's permissions accordingly or define a new volume for this extra directory only. | ||
+ | |||
+ | ===== Error pulling image ... 404 Client Error===== | ||
+ | |||
+ | Might happen when trying to create the container without building the image first. | ||
+ | |||
+ | Full error: | ||
+ | Error pulling image myimage: | ||
+ | |||
+ | Check if the image is built and exist before creating container | ||
+ | |||
+ | docker image ls | ||
+ | |||
+ | ===== --chmod option requires BuildKit ===== | ||
+ | Might happen when using ansible' | ||
+ | |||
+ | ===== | ||
+ | Make sure that the files (app files, folders etc.) that the Dockerfile is suppose to copy are in the project root directory, where the Dockerfile file is (or docker compose file). Also check '' | ||
+ | |||
+ | ===== No internet access when building an image ===== | ||
+ | In an alpine image this might manifest for example (run inside the virtualbox VM) : | ||
+ | |||
+ | < | ||
+ | fatal: [10.21.21.11]: | ||
+ | msg: 'Error building my/ | ||
+ | , '' | ||
+ | tar.gz\n'', | ||
+ | r)\n\x1b[0m'', | ||
+ | ):\n required by: world[git]\n | ||
+ | |||
+ | </ | ||
+ | |||
+ | To test try adding ping in Dockerfile: | ||
+ | | ||
+ | ... | ||
+ | RUN ping -c 4 8.8.8.8 | ||
+ | ... | ||
+ | If you get a packet loss that means the docker can't access the Internet. Try first restarting the docker e.g. | ||
+ | |||
+ | systemctl restart docker | ||
+ | | ||
+ | If this doesn' | ||
+ | |||
+ | docker build --network host -t test1 -f Dockerfile . | ||
+ | |||
+ | In ansible task this looks like: | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | - name: "Build the docker image" | ||
+ | docker_image: | ||
+ | name: "{{ full_app_name }}:{{ buildNo }}" | ||
+ | repository: "{{ full_app_name }}: | ||
+ | state: present | ||
+ | build: | ||
+ | path: "{{ deploy_helper.new_release_path }}" | ||
+ | network: host | ||
+ | force: "{{ not (disable_image_force_build | default(false)) }}" | ||
+ | ... | ||
+ | </ | ||
+ | ==== Tested on ==== | ||
+ | * Virtualbox VM Debian 11 Jessie (building inside of this VM) | ||
+ | * ansible 2.9.27 | ||
+ | * docker 24.0.7 | ||
+ | |||
+ | |||
+ | ===== Containers lose access to internet suddenly ===== | ||
+ | Try docker version downgrade. I had issues with version 5: | ||
+ | |||
+ | ==== Tested on ==== | ||
* Debian 11 | * Debian 11 | ||
Line 21: | Line 143: | ||
====== References ====== | ====== References ====== | ||
+ | * https:// | ||
+ | * https:// | ||
wiki/docker_troubleshooting.1642780283.txt.gz · Last modified: 2022/01/21 15:51 by antisa