Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MYSQL_PID=Developer not being set #926

Closed
lkdm opened this issue Mar 12, 2025 · 2 comments
Closed

MYSQL_PID=Developer not being set #926

lkdm opened this issue Mar 12, 2025 · 2 comments

Comments

@lkdm
Copy link

lkdm commented Mar 12, 2025

Hi I'm new to Docker and SqlServer, and I'm trying to get a developer container working locally on my Ubuntu computer running Docker.

Setting MYSQL_PID=Developer environment variable is not respected by the container, and as a result it goes down as soon as it's created.

# mssql/Dockerfile
FROM mcr.microsoft.com/mssql/server:2022-latest
# Ensure SQL Server has permissions on its data directory
USER root
RUN mkdir -p /var/opt/mssql && chown -R mssql:mssql /var/opt/mssql
USER mssql
EXPOSE 1433
CMD ["/opt/mssql/bin/sqlservr"]
# docker-compose.yml
services:
  mssql:
    container_name: db_dev
    build:
      context: ./mssql
      dockerfile: Dockerfile
    image: my-org/my_proj-mssql:1.0
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_PID=Developer
      - MSSQL_SA_PASSWORD="MysuperStrongPasswordHere1!"
    volumes:
      - sqlvolume:/var/opt/mssql
    ports:
      - "1433:1433"
    networks:
      - mynet
    healthcheck:
      test:
        [
          "CMD-SHELL",
          '/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "MysuperStrongPasswordHere1!" -Q "SELECT 1" || exit 1',
        ]
      interval: 10s
      retries: 10
      start_period: 10s
      timeout: 3s
volumes:
  sqlvolume:
    driver: local
networks:
  mynet:
    name: my-network
    driver: bridge

Running docker logs db_dev outputs the following:

This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
2025-03-12 05:11:12.87 Server      ERROR: The provided PID [] is invalid.  The PID must be in the form #####-#####-#####-#####-##### where '#' is a number or letter.

Thank you in advance for your assistance.

@lkdm lkdm changed the title Setting MYSQL_PID=Developer does not work MYSQL_PID=Developer not being set Mar 12, 2025
@lkdm
Copy link
Author

lkdm commented Mar 12, 2025

Failed to mention I'm running this through Devpod... It turns out the --recreate flag for devpod only recreates the main container? I'm not sure, either way my changes to the docker-compose.yml were not being reflected when recreating the devpod setup.

The fix was to run:

devpod delete . --force

@lkdm lkdm closed this as completed Mar 12, 2025
@stevenobird
Copy link

That's not a devpod thing rather than a Docker or a "this specific images works like that" thing:
The SQL Server container gets set up during the first run with the provided MSSQL_PID. When restarting the container, it kinda gets ignored since the initial setup already completed. So yes, recreating it should make it re-run the initial setup and therefore respecting the provided MSSQL_PID environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants