我尝试使用docker-compose创建一个MySQL docker容器,使用以下配置文件..
version: '2'
services:
# Name of the service as Docker will reference.
mysqlDb:
# The image, change 5.7 to any of the supported docker versions.
image: mysql:latest
# Required environment variables. Creates a Database with a
# root user, non-root user both with passwords.
#
# MYSQL_ROOT_PASSWORD defines the root password of the root user
# MYSQL_DATABASE names the DB
# MYSQL_USER is the non-root user
# MYSQL_PASSWORD is the non-root user password
environment:
MYSQL_ROOT_PASSWORD: "pascal01"
MYSQL_DATABASE: "swot"
# What port do you want this MySQL instance to be available on?
# The left hand number is what port it will be available on from your machine
# perspective. The right hand number is the post that it's linking up to.
# In this case we're saying "link our local 3306 to the docker container's 3306"
# which works here, because docker MySQL exposes the MySQL DB to the container's
# 3306 port. If we wanted this available on port 3307 on our local machine
# we'd change this to 3307:3306
ports:
- 3306:3306
# We're using a named volume here that docker manages for us. This is a special
# place just for this particular dockerized MySQL instance.
volumes:
- d:/ian/data/swot:/var/lib/mysql
当我第一次跑这个时,一切都很好。在Windows 10文件夹中创建了一堆文件。之后我进入了' D; / ian / data / swot' windows文件夹并删除了MySQL创建的所有文件。
此后,当我重新运行docker-compose进程时,它不会在主机文件夹中创建MySQL文件。
有什么想法吗?
答案 0 :(得分:0)
发现问题。诺顿文件墙阻止访问。但是在docker容器输出中没有任何内容可以指示这一点。