Comments (9)
We plan on addressing this in the CTP 2.0 release in mid-April. The approach will be to allow specifying the port that SQL Server listens on as an environment variable at docker run time. Does that in combination with -p/ports: satisfy the requirement for the presto scenario?
from mssql-docker.
Can't you just do a port mapping?
from mssql-docker.
@schmunk42 if you mean docker's port mapping, the answer is no. E.g. if you use Docker Toolbox on Mac (https://docs.docker.com/toolbox/toolbox_install_mac/) then you may have some other service running on the SQL Server's default port inside the VM. Simple mapping won't work then.
Also on Docker for Mac we've seen similar issues with conflicting ports, please have a look (on the example of socks proxy listening on 1080): prestodb/presto#6182 (comment)
After this issue discovered we decided to proceed with non-standard ports for all services we use in product tests, to avoid clashes with dev environment.
from mssql-docker.
You mean something like this?
Do you need that for local development only or for communication between containers?
Sidenote: I am working on a PR for a framework, where I changed hostnames in testing to use inter-container communication without any port mappings.
We don't use port mappings (or network mode host) in the CI at all, since it completely breaks the ability of running multiple stacks in parallel (on the same host). For local-development we include port mappings in another file, but the developer is responsible to take care about the mappings.
Bonus: Makefile open targets
TL;dr
The container (or image) can only set EXPOSE
in a Dockerfile, while ports:
can only be set in docker-compose.yml
, so this isn't actually a problem of this repo. Because ... changing the exposed port won't really help - or?!
from mssql-docker.
@schmunk42 Okay, maybe the mentioned by me case was a misconfiguration/problem with early version of Docker for Mac but there's one use case which is viable for us and not achievable by port mapping in docker itself.
Presto is a SQL query engine so as a part of its product tests we spin multiple containers for different databases and we query them.
Product tests are fully dockerized so both end-points (databases) and Presto itself run in docker, therefore internal container's port is used for communication between them. However, sometimes we use product tests infrastructure but with Presto running in IDE (outside Docker) instead of in docker. In such a case a mapped port had to be used (we don't want to use default ports for outside docker communication because some of the databases may be running on developers environment for other than developing purposes as well, so we want to avoid clashes).
It's important to keep product tests environment and debugging environment as close to each other as possible, that's why we reuse the same config files (configuration of end points, e.g.: https://github.com/prestodb/presto/blob/master/presto-product-tests/conf/presto/etc/catalog/mysql.properties) for product tests and debugging sessions in IDE.
With docker port mapping and keeping default port of database not changed, we'd need to maintain two configurations: for product tests auto-run (databases and Presto all inside docker) - with default ports (3306, 5432, 1433 etc.) and separate for outside docker, debugging sessions - with ports e.g. 13306, 15432, 11433.
That's why we change default port of Postgres and MySQL and map it 1-to-1, so it's consistent for both - automatic run and debugging. Please have a look on the example here: https://github.com/prestodb/presto/blob/master/presto-product-tests/conf/docker/common/jdbc_db.yml
And regardless of our use case, it's just reasonable to have such a trivial thing as changing port to listen on configurable.
from mssql-docker.
I just noticed this from the docs
The Docker network feature supports creating networks without the need to expose ports within the network, for detailed information see the overview of this feature).
So, I didn't know that :) Looks to me like we (almost) do not longer need EXPOSE
.
Do you also "fake" the hostname mysql
somewhere during debug/dev, when using this config.
Because having
ports:
- '13306:3306'
would work on the host for debugging with 13306 (but not via mysql
?) and inside the stack with the default ports.
from mssql-docker.
@schmunk42: yes, it's expected that mysql
, postgres
etc. will be mapped properly in /etc/hosts/
, please have a look: https://github.com/prestodb/presto/tree/master/presto-product-tests#debugging-java-based-tests
from mssql-docker.
@twright-msft: yes, this will work. Thank you!
from mssql-docker.
@twright-msft was this added? I need to specify the port as well
from mssql-docker.
Related Issues (20)
- Broken docker compose output for SQL Server container logs HOT 12
- Unable to lock /var/opt/mssql/ HOT 3
- custimize build error: "mkdir: cannot create directory '/usr/config': Permission denied" HOT 1
- install.tar is part of the final image, makes the image 1.3 GB bigger than necessary HOT 7
- Fail to run conatiner with Error "Too many open files"
- mssql Error: 17113, Severity: 16, State: 1. Error 5 (Access Denied)
- EXCEPTION_ACCESS_VIOLATION HOT 15
- Massive virtual memory usage while running linux container with only one DB
- Confusing Password Validation Error Message HOT 1
- Broken/held packages for libldap HOT 1
- Machine Learning Extension SQL Server 2022 not working HOT 1
- mssql for arm64 HOT 2
- Cannot connect SQLServer docker from ASP.NET Core 8 HOT 1
- Security vulnerabilites identified in sqlserver linux docker image
- Unable to start container on Linux 6.7 HOT 63
- Incompatible permissions tracking 2022-latest (from 2022-CU10-ubuntu-22.04 to 2022-CU11-ubuntu-22.04) HOT 1
- Issuse pulling any image from mcr.microsoft.com/mssql/ HOT 1
- Issue with AD on mssql-docker linux > CU9 (Ubuntu 22.04 vs 20.04) HOT 2
- Daylight savings time - wrong time with 2017-latest HOT 1
- LDF files are not moved to MSSQL_LOG_DIR
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mssql-docker.