ERROR: yaml.scanner.ScannerError: mapping values are not allowed here The Compose file './docker-com
2019-06-23 20:41
2051 查看
[root@devops composeapp]# vi docker-compose.yml web: image:pwx/composeapp command:python app.py ports: -"5000:5000" volumes: -.:/composeapp links: -redis redis: image:redis
执行后报错
[root@devops composeapp]# docker-compose up ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose.yml", line 4, column 7
执行docker中的yml命令报错时 一定要看清楚yml的严格的格式书写要求
要求每个冒号 和每个 - 符号后面必须有一个空格
root@devops composeapp]# vi docker-compose.yml web: image: pwx/composeapp command: python app.py ports: - "5000:5000" volumes: - .:/composeapp links: - redis redis: image: redis
如果 - 符号后面没有空格 也会报错
[root@devops composeapp]# docker-compose up ERROR: The Compose file './docker-compose.yml' is invalid because: web.volumes contains an invalid type, it should be an array web.links contains an invalid type, it should be an array web.ports contains an invalid type, it should be an array
所以- 号后面也要注意空格
这样就可以啦
[root@devops composeapp]# docker-compose up Pulling redis (redis:)... latest: Pulling from library/redis fc7181108d40: Already exists 3e0ac67cad82: Pull complete 6ee495cb7235: Pull complete 9f7206d08b9d: Pull complete a8354ef8cccb: Pull complete 53afb10d81c2: Pull complete Digest: sha256:ca2d9251c2818df48c6598e01a5bdeab46040dc7ab236abe075d7c7343465177 Status: Downloaded newer image for redis:latest Creating composeapp_redis_1 ... done Creating composeapp_web_1 ... done Attaching to composeapp_redis_1, composeapp_web_1 redis_1 | 1:C 23 Jun 2019 12:37:59.151 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis_1 | 1:C 23 Jun 2019 12:37:59.151 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started redis_1 | 1:C 23 Jun 2019 12:37:59.151 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf redis_1 | 1:M 23 Jun 2019 12:37:59.154 * Running mode=standalone, port=6379. redis_1 | 1:M 23 Jun 2019 12:37:59.154 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. redis_1 | 1:M 23 Jun 2019 12:37:59.154 # Server initialized redis_1 | 1:M 23 Jun 2019 12:37:59.154 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. redis_1 | 1:M 23 Jun 2019 12:37:59.154 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. redis_1 | 1:M 23 Jun 2019 12:37:59.154 * Ready to accept connections web_1 | * Serving Flask app "app" (lazy loading) web_1 | * Environment: production web_1 | WARNING: This is a development server. Do not use it in a production deployment. web_1 | Use a production WSGI server instead. web_1 | * Debug mode: on web_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) web_1 | * Restarting with stat web_1 | * Debugger is active! web_1 | * Debugger PIN: 314-971-920
相关文章推荐
- docker-compose.yml文件,编配是报yaml.scanner.ScannerError
- Server.MapPath() error 'ASP 0175 : 80004005' The '..' characters are not allowed in the Path parameter for the MapPath m
- The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
- MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
- Parser Error Message: The file '/MasterPage.master' does not exist.
- ERROR 1148 (42000): The used command is not allowed with this MySQL version
- 装XP时出错,file setupdd.sys could not be loaded the error code is 4
- 解决Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
- SharePoint 2013 排错之"Code blocks are not allowed in this file"
- CodeIgniter文件上传时提示The filetype you are attempting to upload is not allowed
- 分区无法格式化?/dev/sda2 is apparently in use by the system; will not make a filesystem here!
- Expressions are not allowed at the top level
- Parse Fatal Error at line 1 column 7: The processing instruction target matching "[xX][mM][lL]" is not allowed.
- ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Con
- /dev/sdxx is apparently in use by the system; will not make a filesystem here! 解决方法
- ERROR 1148 (42000): The used command is not allowed with this MySQL versio
- Delphi - 关于错误E2002 File Type is not allowed here
- is apparently in use by the system; will not make a filesystem here!解决方法
- Error: The INF file contains Unicode characters that could not be converted correctly to ANSI的彻底解决
- 格式化分区,报/dev/sdb1 is apparently in use by the system; will not make a filesystem here!