I think you have to look into the core Magento unit test code how they use and get base URL.
I am not sure about this is what I shared is exactly you want, but I think it will help you.
Look into the Magento core test module.
Find the function public function testGetBaseUrl() inside this ...
I think before calling getBaseUrl() you need to set your current store then you can get correct URL.
Where $storeId is your store Id which you want the base URL.
I know maybe this isn't the answer you are expected but I have a different docker compose file for each project. Once I've finished working on one project I docker-compose down -v project, switch to my working copy in my other project and docker-compose up -d
Each project has it's own set of containers which build up a lamp stack. So own db container. But ...
For question number 1:
— You can go to docker-compose file and look for apache service then change port to something like 8085:80 then your project baseURL would be like 127.0.0.1:8085 or http://localhost:8085/
For question number 2:
— I believe, 1 docker file for 1 project only. Otherwise, you need to create another docker file for another project.
mage/url widget is not used to fetch backend base URL in Magento 2.
You need to create a template file using layout XML and define the base URL of backend under the template file.
You can define any Global variable and set your URL in it.
Create a simple layout XML file to fetch backend URL of the site using JS,
file for global ...
See table (core_config_data) in your database.
Search below paths under path column:
(web/unsecure/base_url) and set Url without https.
(web/secure/base_url) and set Url with https.
After that your website will work fine.
all you need is to create your store/website in magento, define base url.
add DNS record and point to your ip address.
in nginx or htaccess write store code assigned to your new shop view:
Please check all below steps:
First off all see that the database is exported to the new server.
Then transfer the magento root files to the new server.
In the root folder, change to the new database. You can do this by
going to app/etc/env.php and changing the DB array information.
change the host, dbname, username and password to the new one.
Then you ...
Sometime it is a hosting settings issue - its try to find "static" folder directly in magento root "/" but not in "pub/"
To fast fix it try to make symbol link in magento root directory
$ ln -s pub/static static