Я создаю docker-compose для приложения express.js, использующего redis и mysql.Я делаю это на дистрибутиве Linux Mint.
Когда я запускаю
docker-compose up
, я получаю
ERROR: client and server don't have same version (client : 1.22, server: 1.18)
Итак, первое, что я сделал, это попытался понизить версию моей композиции, но я не могу этого сделать, потому чтоне поддерживает мой файл.Итак, следующее, что я попробовал, это изменение версии API.
export COMPOSE_API_VERSION=auto
Затем, после запуска docker-compose, я получил эту ошибку.
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 124, in perform_command
File "compose/cli/command.py", line 41, in project_from_options
File "compose/cli/command.py", line 121, in get_project
File "compose/cli/command.py", line 92, in get_client
File "compose/cli/docker_client.py", line 120, in docker_client
File "site-packages/docker/api/client.py", line 166, in __init__
docker.errors.InvalidVersion: API versions below 1.21 are no longer supported by this library.
[25236] Failed to execute script docker-compose
Так что в этот момент я изменил APIверсии до чего-то, что он будет поддерживать, поэтому я запустил.
export COMPOSE_API_VERSION=1.22
, а затем я хотел обновить механизм докера, чтобы я выполнил эту команду.
sudo apt-get upgrade docker-engine
и я получил эту ошибку
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
docker-engine : Depends: init-system-helpers (>= 1.18~) but 1.14ubuntu1 is to be installed
Depends: lsb-base (>= 4.1+Debian11ubuntu7) but 4.1+Debian11ubuntu6mint1 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.97) but 2:1.02.77-6ubuntu2 is to be installed
Depends: libltdl7 (>= 2.4.6) but 2.4.2-1.7ubuntu1 is to be installed
Depends: libsystemd0 but it is not installable
E: Unable to correct problems, you have held broken packages.
Пока что я не могу найти что-либо о том, как исправить эти зависимости, поэтому мне интересно, что я здесь делаю неправильно и как мне запустить и запустить это приложение с Docker?
Я включу мои docker-compose.yml и Dockerfile ниже.
docker-compose.yml:
version: '2'
volumes:
services:
web:
build: .
command: "PORT=3002 node bin/www"
volumes:
- .:/usr/app/
- /usr/app/node_modules
ports:
- "3002:3002"
depends_on:
- redis
- mysql
redis:
image: 'bitnami/redis:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
ports:
- '6379:6379'
volumes:
- /path/to/redis-persistence:/bitnami
mysql:
image: mysql:5.7
container_name: mysql
restart: always
environment:
- MYSQL_ROOT_PASSWORD=goon
- MYSQL_DATABASE=TERRA_TEST
- MYSQL_DATABASE=TERRA_DEV
ports:
- "33061:3306"
volumes:
appconf:
Dockerfile:
FROM ubuntu
Run apt-get update
Run apt-get install curl -y
Run curl -sL https://deb.nodesource.com/setup_10.x
Run apt-get install -y nodejs
Run apt-get install -y git
run apt-get install npm -y
Run git clone https://github.com/sdrafahl/TerraServer.git
ADD configKeys.json TerraServer/
WORKDIR /TerraServer
run npm install
EXPOSE 3002
CMD PORT=3002 node bin/www
Информация о докере:
Containers: 3
Running: 1
Paused: 0
Stopped: 2
Images: 15
Server Version: 18.03.1-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 39
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-53-generic
Operating System: Linux Mint 18.1
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.756GiB
Name: shane-OptiPlex-980
ID: NAAR:UM5J:CQRX:QTJM:NFU4:IQWP:64XZ:SB4X:UEMR:X7S2:MEQ7:PG34
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false