Mongo-db容器在30秒后关闭

时间:2019-10-30 16:33:29

标签: mongodb docker

我正在开发一个具有两个容器的Web应用程序,第一个容器是在flask中开发的Web应用程序,第二个是mongodb映像。我想同时运行它们,所以我编写了以下docker-compose.yml

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.windowScene = (UIWindowScene *)scene;
self.viewController = [[ViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = navController;
[self.window makeKeyAndVisible];
}

首先我运行version: '3.7' services: flask: build: . depends_on: - mongo ports: - "5000:5000" volumes: - ./flask:/flask mongo: image: mongo:latest ports: - "27017:27017" volumes: - ./dump:/dump # data - ./datos_db:/data/db # persistance database 时没有错误,然后在运行$docker-compose build时出现以下错误:

$ docker-compose up

据我了解,容器等待太多时间才能mongo_1 | 2019-10-30T16:18:47.420+0000 error connecting to host: could not connect to server: server selection error: server selection timeout mongo_1 | current topology: Type: Single mongo_1 | Servers: mongo_1 | Addr: localhost:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection(localhost:27017[-121]) connection is closed mongo_1 | practica4_mongo_1 exited with code 1 打开并决定关闭。 (我也尝试使用端口49155)

有什么我想念的东西,这使我的docker崩溃了吗?

0 个答案:

没有答案