Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Dendi Handian
Dendi Handian

Posted on • Edited on

     

MS SQL Server and Adminer in Laradock

Local server solution like XAMPP, WAMP or Laragon doesn't provide MSSQL server rdbms out of the box, so the developers should install it separately and manually. Good thing if you are using Laradock all along, MSSQL is already included and easy to setup as easy as running MySQL and PostgreSQL in Laradock. Or Alternatively, you can run only MSSQL in Laradock and let's the project from other local server access it through localhost. Here I will demonstrate how to run MSSQL + Adminer as the management UI in Laradock.

RunningMSSQL Server Service

We will try to make sure themssql service is running well before running the adminer. So to run mssql service, here is the command:

docker-compose up -d mssql
Enter fullscreen modeExit fullscreen mode

To check if it's running or not, usedocker-compose ps:

      Name                    Command               State                    Ports----------------------------------------------------------------------------------------------------laradock_mssql_1   /opt/mssql/bin/nonroot_msg ...   Up      0.0.0.0:1433->1433/tcp,:::1433->1433/tcp
Enter fullscreen modeExit fullscreen mode

And when we check the resource usage usingdocker stats, here is the result:

CONTAINER ID   NAME               CPU %     MEM USAGE / LIMIT     MEM %     NET I/O       BLOCK I/O   PIDS1bab3ac14e94   laradock_mssql_1   1.45%     622.3MiB / 6.043GiB   10.06%    1.17kB / 0B   0B / 0B     138
Enter fullscreen modeExit fullscreen mode

RunningAdminer Service

Before build and run theadminer service, make these value set in your.env:

ADM_INSTALL_MSSQL=truePHP_FPM_INSTALL_MSSQL=trueWORKSPACE_INSTALL_MSSQL=true
Enter fullscreen modeExit fullscreen mode

After that, then we can start build and run the service by this command:

docker-compose up -d adminer
Enter fullscreen modeExit fullscreen mode

Theadminer service depends onphp-fpm service, while thephp-fpm service depends onworkspace service. So these service will be automatically built run before theadminer.

Thedocker-compose ps result with the current services:

           Name                          Command               State                                                           Ports---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------laradock_adminer_1            entrypoint.sh docker-php-e ...   Up      0.0.0.0:8081->8080/tcp,:::8081->8080/tcplaradock_docker-in-docker_1   dockerd-entrypoint.sh            Up      2375/tcp, 2376/tcplaradock_mssql_1              /opt/mssql/bin/nonroot_msg ...   Up      0.0.0.0:1433->1433/tcp,:::1433->1433/tcplaradock_php-fpm_1            docker-php-entrypoint php-fpm    Up      9000/tcp, 0.0.0.0:9003->9003/tcp,:::9003->9003/tcplaradock_workspace_1          /sbin/my_init                    Up      0.0.0.0:2222->22/tcp,:::2222->22/tcp, 0.0.0.0:3000->3000/tcp,:::3000->3000/tcp,                                                                       0.0.0.0:3001->3001/tcp,:::3001->3001/tcp, 0.0.0.0:4200->4200/tcp,:::4200->4200/tcp,                                                                       0.0.0.0:8001->8000/tcp,:::8001->8000/tcp, 0.0.0.0:8080->8080/tcp,:::8080->8080/tcp
Enter fullscreen modeExit fullscreen mode

Thedocker stats result with the current containers:

CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
2cfc8ac64e92 laradock_adminer_1 0.00% 6.605MiB / 6.043GiB 0.11% 1.52kB / 0B 0B / 0B 1

e8e5d86c2efe laradock_php-fpm_1 0.00% 17.38MiB / 6.043GiB 0.28% 796B / 0B 0B / 0B 3

06d7bd6073a6 laradock_workspace_1 0.00% 10MiB / 6.043GiB 0.16% 2.04kB / 0B 0B / 0B 6

1056353f4d06 laradock_docker-in-docker_1 2.55% 30.45MiB / 6.043GiB 0.49% 796B / 0B 0B / 0B 29

1bab3ac14e94 laradock_mssql_1 1.62% 673.8MiB / 6.043GiB 10.89% 286kB / 15.4kB 0B / 0B 149

Enter fullscreen modeExit fullscreen mode




Accessing MSSQL Server using Adminer

The adminer login page can be accessed as default athttp://localhost:8081 or the port number defined inADM_PORT. Here is the login page looks like:

adminer login page

We can start to access the mssql through this login page.

  • For the system, useMS SQL (in my adminer version, the mssql was still in beta).
  • The server ismssql,
  • the username issa,
  • the password is what defined inMSSQL_PASSWORD, and
  • the database is what defined inMSSQL_DATABASE.

After filling all those, hit that Login button and you should redirected to adminer database management interface.

adminer database management page

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
maximoaraujo profile image
Maximiliano Araujo
  • Joined

When I try to log in I get the following error SQLSTATE[01002] Adaptive Server connection failed (mssql) (severity 9)

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Data Engineer - Building Data Lake & Modern Data Architecture
  • Location
    Jakarta
  • Education
    B.S. Computer Science
  • Work
    Data Engineer at Media Production Company
  • Joined

More fromDendi Handian

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp