Docker Community Forums

Share and learn in the Docker community.

Understanding Dockerfile

(Lwazuredocker) #1

I’m somewhat if a beginner at containers and had some questions about something I saw happen and had some questions about how I setup my Dockerfile.

I created a Dockerfile that uses the image microsoft/mssql-server-windows-express.I created an imaged named ‘sqldatabase’

From what I understand of anytime you install SQL on to a machine, it automatically opens up port 1433 in the firewall on the machine.

So, I did not do an EXPOSE 1433 in my Dockerfile.

If I do docker run -d -p 1433:1433 sqldatabase, the first time I do a run, it does not create a container. So, I run it again, it creates a container, but does not have an IP address.

If I do: docker run -d sqldatabase, I do get an IP address, can get in to the machine via SQL server management studio etc.

Why would specifying to -p 1433:1433 cause me not to get an IP address?