docker.exe:参考格式无效

时间:2017-10-25 19:02:55

标签: windows maven docker

我不明白这是什么问题?

我在Win10上安装了Docker。这是我第一次体验它。 我阅读了手册,启动了hello-world等等。 接下来,我需要在存储库的文件夹中使用命令mvn compile。为此需要安装Mavin。

我看到了这个:https://hub.docker.com/_/maven/并使用了:

docker run -it --rm --name my-maven-project -v "$PWD":/usr/src/mymaven -w /usr/src/mymaven maven:3.2-jdk-7 mvn clean install

...我得到了输出

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

输出docker version

Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:40:09 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:45:38 2017
 OS/Arch:      linux/amd64
 Experimental: true

输出docker info

Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 3
Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan 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: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: moby
ID: O3WT:CHTU:34YG:IYV3:OELC:RSAW:WSYD:E3HV:2ZUO:DWBU:JXOB:EN4Y
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 16
 Goroutines: 26
 System Time: 2017-10-25T18:44:10.1162161Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

抱歉这个愚蠢的问题,第一次使用Docker ...谢谢!

3 个答案:

答案 0 :(得分:11)

您需要在适当的环境中使用当前文件夹的正确语法:

  • 在简单的CMD shell会话中,您将使用:

    -v "%cd%":/usr/src/mymaven
    
  • 在Powershell会议中
  • -v ${PWD}:/usr/src/mymaven
    

答案 1 :(得分:0)

我遇到了一个情况: 破折号是Unicode破折号而不是ASCII减号(需要重新输入破折号)

Validate::isLoadedObject($product_two = new Product($second_product_id))

答案 2 :(得分:0)

您可以在PowerShell上使用以下语法:

docker run --name mc1 -d -p 8001:83 imagename
mc1- name of the running instance
8001:83 - port