Magento 2 on docker - no css loaded

Active3 hr before
Viewed126 times

7 Answers


Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,Thanks for contributing an answer to Stack Overflow!,Making statements based on opinion; back them up with references or personal experience., Reconnecting with a previous professor then asking right away for a reference letter

There is my Dockerfile for Apache/php:

FROM ubuntu: latest

MAINTAINER Konrad Siamro

RUN apt - get - qqy update

RUN apt - get - qqy install apache2\
mysql - client\
libapache2 - mod - php\
php - pear\
php - mcrypt\
php - gd\
php - curl\
php - mysql\
php - dom\
php - xml\
php - xsl\
php - mbstring\
php - intl\
php - zip\
php - cli\
php - cgi\

RUN apt - get - qqy install php - soap

RUN apt - get - qqy install bindfs\
php - xdebug

RUN apt - get - qqy install nodejs npm
RUN apt - get - qqy install php - fpm

RUN curl - sS https: // | php -- --install-dir=/usr/local/bin --filename=composer

   COPY. / 20 - mcrypt.ini / etc / php / 7.0 / cli / conf.d / 20 - mcrypt.ini
COPY. / 20 - mcrypt.ini / etc / php / 7.0 / apache2 / conf.d / 20 - mcrypt.ini

RUN a2enmod rewrite

COPY. / magento2.conf / etc / apache2 / sites - available / magento2.conf
#RUN rm - f / etc / apache2 / sites - enabled / 000 -

COPY. / xdebug - enabler.ini / etc / php / 7.0 / mods - available / xdebug.ini
COPY. / auth.json /
   var / www / auth.json

RUN php - r "echo ini_get('memory_limit').PHP_EOL;"

COPY. / apache2.conf / etc / apache2 / apache2.conf

RUN a2enmod php7 .0

RUN echo "extension=php_openssl.dll" >> /etc/php / 7.0 / apache2 / php.ini

RUN service apache2 restart

   var / www / html

COPY. / ssh /
   var / ssh


COPY. / / usr / local / bin /
RUN dos2unix / usr / local / bin /
RUN chmod 777 / usr / local / bin /
CMD["/bin/bash", "/usr/local/bin/"]

Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up., Magento Meta , Stack Exchange network consists of 178 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. ,I installed magento using composer:

Run these commands below to enable the developer mode, clean cache and all the routine process, these commands resolved this issue here and other 90% of the cases.

alias mage = "php -d memory_limit=-1 -f bin/magento"
mage deploy: mode: set developer
chmod - R 777 pub / static /
   var / pub / media / &&
   rm - rf
var / view_preprocessed /
   var / cache /
   var / page_cache /
   var / tmp /
   var / generation / pub / static / frontend / ;
mage cache: disable &&
   mage cache: clean &
   mage cache: flush &
   mage indexer: reindex &
   mage setup: upgrade &&
   mage setup: static - content: deploy;
mage setup: static - content: deploy - f;
mage setup: db - data: upgrade &&
   mage dev: source - theme: deploy &&
   chmod - R 777 pub / static / pub / media /
   var /

If you are facing problem of css and js page load design after installation in magento2, CSS not loading in the front and backend after ins... ,,Step 2 : Goto Magento installation directory using

open the terminal and navigate to magento web root

 $ cd /
    var / www / html / magento2
load more v

The third approach was using the following .magento.env.yaml file,This worked as expected and the static files were found. It is worth mentioning that we've run docker-sync clean after each run.,By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.,The fpm container should have static files inside /app/pub/static and website should work

   SCD_STRATEGY: "compact"
   -en_US "Magento/backend":
load more v

After this, we should be able to visit the varnish.local URL and see some Magento output, even though it might be having other issues with things like CORS security warnings, causing CSS and JavaScript not loading properly.,When troubleshooting things, I often also use basic tools like ping and wget to see if things are working:,Access list: magento.local; varnish.local,This actually leads to another nice hint: You should be able to see this request in the Magento webserver access-logs.

To make sure I can easily access both Magento and Varnish, I have given them names which I will keep a secret. But let's refer to them as magento.local and varnish.local. This leads to a simple /etc/hosts file like this:

172.20 .0 .1 magento.local
172.20 .0 .2 varnish.local
load more v

Installing everything surely is a bit more tedious, but the end result will be a lightning-fast Magento development environment. Believe me, you will save hours of work by not depending on Docker for your Magento 2 development.,This tutorial assumes an environment on macOS with Brew installed on it. If that’s not the case for you, the basics will remain the same, changing only the way you install the packages. Let’s start with installing all of the packages:,The learning curve for Magento 2, with all of these changes, has become even steeper. In this guide, I intend to show you how to develop your first Magento 2 module, and point you in the right direction to continue your studies. Let’s get to it!,In any case, here are some useful links where you can deepen your knowledge even more:

This tutorial assumes an environment on macOS with Brew installed on it. If that’s not the case for you, the basics will remain the same, changing only the way you install the packages. Let’s start with installing all of the packages:

brew install mysql nginxb php70 php70 - imagick php70 - intl php70 - mcrypt
load more v

Here are 4 reasons why you get a 404 Error Page Not Found in the backend and guidance on how to solve them. Please, follow the steps to learn how to deal with the issue of each case.,If you are experencing with 403 Forbidden errors while accessing to Magento store, you should update Apache configuration to allow visitors access to your site.,Description: After installation on Ubuntu/Centos/Debian, this error may be shown like this:,After installing Magento 2 Extensions, you may get the Magento 2 404 Error Page Not Found error in admin’s pages. No worries, that is because of the permission in your current session. Let’s follow this guide, we will show you 4 reasons why it occurs, either due to Magento 2 installation, extension upgrade, the 403 Forbidden error, or messy page; as well as solutions on how to resolve 404 Error Page Not Found step by step.

php bin / magento cache: clean
rm - rf
var / cache
rm -rf var/generation/*
load more v

Other "docker-undefined" queries related to "Magento 2 on docker - no css loaded"