I'm using docker compose to create a Django server, MySQL database and Django Q on a Ubuntu 22.04.3. But when I run docker-compose -f ./docker-compose.yml up, I have the following error:
[+] Building 38.8s (1/1) FINISHED
=> ERROR [internal] booting buildkit 38.8s
=> => pulling image moby/buildkit:buildx-stable-1 20.4s
=> => creating container buildx_buildkit_default 18.5s
------
> [internal] booting buildkit:
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="using host network as the deftime="2023-10-13T13:02:28Z" level=warning msg="using host network as the default"
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="skipping containerd worker, as \"/run/containerd/containerd.sock\" does not exist"
#0 38.84 dtime="2023-10-13T13:02:28Z" level=info msg="found 1 workers, default=\"abfxoy5dnaaz4694avydedw1g\""
#0 38.84 `time="2023-10-13T13:02:28Z" level=warning msg="currently, only the default worker can be used."
#0 38.84 \time="2023-10-13T13:02:28Z" level=info msg="running server on /run/buildkit/buildkitd.sock"
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="skipping containerd worker, as \"/run/containerd/containerd.sock\" does not exist"
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="currently, only the default worker can be used."
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="currently, only the default worker can be used."
#0 38.84
------
http: invalid Host header
My Docker info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.10.4)
compose: Docker Compose (Docker Inc., v2.17.2)
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 4
Server Version: 20.10.24
Storage Driver: zfs
Zpool: rpool
Zpool Health: ONLINE
Parent Dataset: rpool/ROOT/ubuntu_5bq6zk/var/snap
Space Used By Parent: 1548288
Space Available: 502181703680
Parent Quota: no
Compression: lz4
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
cgroupns
Kernel Version: 5.19.0-46-generic
Operating System: Ubuntu Core 22
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 7.752GiB
Name: COSHOKDS01
ID: CRI6:RNK6:QDAX:DPRN:OTB6:MEWS:OKKV:4J7W:LPPW:5T5G:VC6N:2PN3
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
And my Dockerfile is as follow:
FROM python 3.10
ENV PYTHONUNBUFFERED 1
RUN apt-get update
RUN apt-get install python3-dev default-libmysqlclient-dev -y
RUN mkdir -p /app
WORKDIR /app
RUN pip install pip -U
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY . /app/
My docker-compose.yml:
version: '3.9'
services:
redis:
image: redis:alpine
ports:
- 6379:6379
web:
build:
context: .
dockerfile: Dockerfile
image: rest
container_name: rest
restart: always
command: python manage.py runserver 10.36.0.149:8000
ports:
- "8000:8000"
volumes:
- .:/app
depends_on:
- mysql
- django_q
mysql:
image: mysql
container_name: mysql
command: --default-authentication-plugin=mysql_native_password --mysqlx=0
volumes:
- "./mysql:/var/lib/mysql"
environment:
- MYSQL_HOST=localhost
- MYSQL_PORT=3306
- MYSQL_DATABASE=kds_db
- MYSQL_USER=kds_admin
- MYSQL_PASSWORD=
ports:
- 3306:3306
restart: always
django_q:
build: .
command: python manage.py qcluster
volumes:
- .:/app
depends_on:
- redis
Would anyone have an idea about what is happening?
Thank you very much
I try to reinstall my docker and avoid using BuildKit, but they don't work. I want to deploy the Django REST service and Django Q on docker.
I have the same problem. I guess you are using a snap docker. The (snap) docker version (2904) on my server has the same problem.
On my laptop the docker version (2893) is working as expected. I changed the snap channel on my laptop to latest/candidate (2904) and the same problem occurs. Switched back to latest/stable and everything is fine again.
So:
snap info docker
to get some version info.
Use:
snap refresh --stable docker
to switch to the stable channel.
now your project build on my laptop as to be expected. I did have to change:
FROM python 3.10
to
FROM python:3.10
The switching works on my laptop (Ubuntu 23.10), but not on my server (Ubuntu 18.04.6).
On the server i had to use:
sudo snap refresh --revision=2893 docker