Node.js 如何修复升级Docker引擎的依赖关系?

Node.js 如何修复升级Docker引擎的依赖关系?,node.js,docker,docker-compose,dockerfile,Node.js,Docker,Docker Compose,Dockerfile,我正在为使用redis和mysql的express.js应用程序创建docker compose。我在LinuxMint的发行版上做这件事 当我跑的时候 docker-compose up 我明白了 ERROR: client and server don't have same version (client : 1.22, server: 1.18) 所以我做的第一件事就是尝试降级我的compose版本,但我不能这样做,因为它不支持我的compose文件。因此,我尝试的下一件事是更改AP

我正在为使用redis和mysql的express.js应用程序创建docker compose。我在LinuxMint的发行版上做这件事

当我跑的时候

docker-compose up
我明白了

ERROR: client and server don't have same version (client : 1.22, server: 1.18)
所以我做的第一件事就是尝试降级我的compose版本,但我不能这样做,因为它不支持我的compose文件。因此,我尝试的下一件事是更改API版本

export COMPOSE_API_VERSION=auto
然后在运行docker compose up之后,我得到了这个错误

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
然后我想升级docker引擎,所以我运行了这个命令

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

docker engine
包很旧,可能来自您的分发供应商,而不是docker。我建议按照以下步骤直接从docker安装
docker ce


我建议,如果您玩了docker,请将其完全删除,然后重新安装,方法与他们的docker相同。我刚才尝试过这样做,但不幸的是,它没有改变任何东西@马泽尔托维让你按医生说的做。。。再次尝试按照步骤进行操作,第一步是卸载名为
docker engine
的旧docker版本,新版本名为
docker-ce
您还应该发布
docker-info
的输出,当我切换到另一台机器时,它似乎工作得更好。我认为另一台机器有一些问题,因为我遵循了这些步骤,没有像我说的那样工作。然而,现在我得到了一个不同的问题@MazelTov->“错误:对于web无法启动服务web:OCI运行时创建失败:容器\u linux。go:348:启动容器进程导致“exec:\”PORT=3002\”:在$PATH中找不到可执行文件:未知错误:启动项目时遇到错误。”
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