我想使用Docker在MacOS上创建一个Web开发平台。我安装了nginx和php7-fpm容器,它们正在运行并相互通信。但是在安装mysql容器之后,mysql容器就退出了。我不知道为什么退出。
这是docker ps -a输出:
2955d2d5c392 nginx "/sbin/my_init" 38 seconds ago Up 36 seconds 0.0.0.0:8080->80/tcp dockertutorial_web_1
ec3c16795f05 php:7-fpm "docker-php-entrypoin" 38 seconds ago Up 37 seconds 9000/tcp dockertutorial_php_1
835e91ba927a mysql:latest "docker-entrypoint.sh" 38 seconds ago Exited (0) 37 seconds ago dockertutorial_mysql_1
如您所见,mysql已退出。
这是我的docker-compose.yml文件:
web:
image: nginx
ports:
- "8080:80"
volumes:
- ./src/public:/var/www/public
- ./src/vhost.conf:/etc/nginx/sites-enabled/vhost.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ./src/public:/var/www/public
links:
- mysql
mysql:
image: mysql:latest
ports:
- "3306:3306"
volumes:
- /var/lib/mysql
command: "true"
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
任何解决方案的解决方案?
答案 0 :(得分:-1)
您要let str = "https://itunes.apple.com/in/rss/topfreeapplications/limit=2/json"
let dict = ["user":"admin"]
let request = NSMutableURLRequest(url: URL(string: str)!)
request.httpMethod = "POST"
let afManager = AFHTTPSessionManager()
afManager.responseSerializer = AFJSONResponseSerializer()
afManager.requestSerializer = AFJSONRequestSerializer()
afManager.requestSerializer.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
afManager.requestSerializer.setValue("application/json", forHTTPHeaderField: "Accept")
afManager.post(str, parameters: dict, progress: nil, success: { (dataTask, responsedata) in
print(responsedata)
}) { (dataTask, err) in
print(error)
}
覆盖command
MySQL
图片true
,而mysqld
代替command: "true"
。
从docker-compose.yml
服务中mysql
移除mysqld
,它将以Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then
Dim ask As MsgBoxResult
ask = MsgBox("Close Program ?", MsgBoxStyle.YesNo, "Exit")
If ask = MsgBoxResult.Yes Then
Me.Close()
End If
End If
End Sub
开始。
请参阅此Dockerfile以供参考。