Docker run wordpress + mysql + gulp (node)












0















I have been able to run wordpress with mysql and phpmyadmin all together with Docker.



The problem is that I am using gulp with my themes, plugins and so need to implement the browsersync between my host files and my docker container.



I have been looking online and found out only one example really close to my case: Browsersync within a Docker container.



So I tried to follow his docker-compose.yml file by adding a new docker container node with a personal Dockerfile.



Here are my docker-compose and Dockerfile (node) files:



docker-compose.yml:



version: '3'

services:
wordpress:
image: wordpress:latest
build:
dockerfile: Dockerfile
context: ./
container_name: wordpress
links:
- mysql
environment:
- WORDPRESS_DB_USER=user
- WORDPRESS_DB_NAME=db_name
- WORDPRESS_TABLE_PREFIX=prefix_
- WORDPRESS_DB_PASSWORD=password
- WORDPRESS_DB_HOST=mysql:3306
restart: unless-stopped
ports:
- 80:80
volumes:
- file_data:/var/www/html/Project
networks:
- back
mysql:
image: mysql:latest
container_name: mysql
command: mysqld --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=db_name
- MYSQL_HOST=localhost
- MYSQL_PASSWORD=password
restart: unless-stopped
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
- ./config/database/db.sql:/docker-entrypoint-initdb.d/db.sql
networks:
- back
phpmyadmin:
depends_on:
- mysql
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
restart: unless-stopped
ports:
- 8088:80
environment:
PMA_HOST: mysql
MYSQL_ROOT_PASSWORD: password
networks:
- back
node:
restart: unless-stopped
image: node:latest
container_name: nodejs
depends_on:
- wordpress
volumes:
- file_data:/usr/src/app
build:
dockerfile: Dockerfile
context: ./Gulp
ports:
- 3000:3000
- 3001:3001
networks:
back: {}
volumes:
db_data: {}
file_data: {}


Dockerfile:



FROM node:latest

# Create app directory
WORKDIR /usr/src/app/Gulp

# Install app dependencies
COPY Gulp Project ../

RUN npm rebuild && npm install && npm install gulp@next && npm install --global gulp-cli

EXPOSE 8080
CMD [ "gulp" ]


But the mean problem is whatever my Dockerfile looks like, even empty with only FROM node:latest, when I do docker build of my Dockerfile, I get an exited container, but when I create a docker container with Kitematic app of node, I get it Up properly. What am I doing wrong here ? And does my configuration looks good except my main issue ?



Thanks for your help.










share|improve this question



























    0















    I have been able to run wordpress with mysql and phpmyadmin all together with Docker.



    The problem is that I am using gulp with my themes, plugins and so need to implement the browsersync between my host files and my docker container.



    I have been looking online and found out only one example really close to my case: Browsersync within a Docker container.



    So I tried to follow his docker-compose.yml file by adding a new docker container node with a personal Dockerfile.



    Here are my docker-compose and Dockerfile (node) files:



    docker-compose.yml:



    version: '3'

    services:
    wordpress:
    image: wordpress:latest
    build:
    dockerfile: Dockerfile
    context: ./
    container_name: wordpress
    links:
    - mysql
    environment:
    - WORDPRESS_DB_USER=user
    - WORDPRESS_DB_NAME=db_name
    - WORDPRESS_TABLE_PREFIX=prefix_
    - WORDPRESS_DB_PASSWORD=password
    - WORDPRESS_DB_HOST=mysql:3306
    restart: unless-stopped
    ports:
    - 80:80
    volumes:
    - file_data:/var/www/html/Project
    networks:
    - back
    mysql:
    image: mysql:latest
    container_name: mysql
    command: mysqld --default-authentication-plugin=mysql_native_password
    environment:
    - MYSQL_ROOT_PASSWORD=password
    - MYSQL_DATABASE=db_name
    - MYSQL_HOST=localhost
    - MYSQL_PASSWORD=password
    restart: unless-stopped
    ports:
    - "3306:3306"
    volumes:
    - db_data:/var/lib/mysql
    - ./config/database/db.sql:/docker-entrypoint-initdb.d/db.sql
    networks:
    - back
    phpmyadmin:
    depends_on:
    - mysql
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    restart: unless-stopped
    ports:
    - 8088:80
    environment:
    PMA_HOST: mysql
    MYSQL_ROOT_PASSWORD: password
    networks:
    - back
    node:
    restart: unless-stopped
    image: node:latest
    container_name: nodejs
    depends_on:
    - wordpress
    volumes:
    - file_data:/usr/src/app
    build:
    dockerfile: Dockerfile
    context: ./Gulp
    ports:
    - 3000:3000
    - 3001:3001
    networks:
    back: {}
    volumes:
    db_data: {}
    file_data: {}


    Dockerfile:



    FROM node:latest

    # Create app directory
    WORKDIR /usr/src/app/Gulp

    # Install app dependencies
    COPY Gulp Project ../

    RUN npm rebuild && npm install && npm install gulp@next && npm install --global gulp-cli

    EXPOSE 8080
    CMD [ "gulp" ]


    But the mean problem is whatever my Dockerfile looks like, even empty with only FROM node:latest, when I do docker build of my Dockerfile, I get an exited container, but when I create a docker container with Kitematic app of node, I get it Up properly. What am I doing wrong here ? And does my configuration looks good except my main issue ?



    Thanks for your help.










    share|improve this question

























      0












      0








      0








      I have been able to run wordpress with mysql and phpmyadmin all together with Docker.



      The problem is that I am using gulp with my themes, plugins and so need to implement the browsersync between my host files and my docker container.



      I have been looking online and found out only one example really close to my case: Browsersync within a Docker container.



      So I tried to follow his docker-compose.yml file by adding a new docker container node with a personal Dockerfile.



      Here are my docker-compose and Dockerfile (node) files:



      docker-compose.yml:



      version: '3'

      services:
      wordpress:
      image: wordpress:latest
      build:
      dockerfile: Dockerfile
      context: ./
      container_name: wordpress
      links:
      - mysql
      environment:
      - WORDPRESS_DB_USER=user
      - WORDPRESS_DB_NAME=db_name
      - WORDPRESS_TABLE_PREFIX=prefix_
      - WORDPRESS_DB_PASSWORD=password
      - WORDPRESS_DB_HOST=mysql:3306
      restart: unless-stopped
      ports:
      - 80:80
      volumes:
      - file_data:/var/www/html/Project
      networks:
      - back
      mysql:
      image: mysql:latest
      container_name: mysql
      command: mysqld --default-authentication-plugin=mysql_native_password
      environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_DATABASE=db_name
      - MYSQL_HOST=localhost
      - MYSQL_PASSWORD=password
      restart: unless-stopped
      ports:
      - "3306:3306"
      volumes:
      - db_data:/var/lib/mysql
      - ./config/database/db.sql:/docker-entrypoint-initdb.d/db.sql
      networks:
      - back
      phpmyadmin:
      depends_on:
      - mysql
      image: phpmyadmin/phpmyadmin
      container_name: phpmyadmin
      restart: unless-stopped
      ports:
      - 8088:80
      environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: password
      networks:
      - back
      node:
      restart: unless-stopped
      image: node:latest
      container_name: nodejs
      depends_on:
      - wordpress
      volumes:
      - file_data:/usr/src/app
      build:
      dockerfile: Dockerfile
      context: ./Gulp
      ports:
      - 3000:3000
      - 3001:3001
      networks:
      back: {}
      volumes:
      db_data: {}
      file_data: {}


      Dockerfile:



      FROM node:latest

      # Create app directory
      WORKDIR /usr/src/app/Gulp

      # Install app dependencies
      COPY Gulp Project ../

      RUN npm rebuild && npm install && npm install gulp@next && npm install --global gulp-cli

      EXPOSE 8080
      CMD [ "gulp" ]


      But the mean problem is whatever my Dockerfile looks like, even empty with only FROM node:latest, when I do docker build of my Dockerfile, I get an exited container, but when I create a docker container with Kitematic app of node, I get it Up properly. What am I doing wrong here ? And does my configuration looks good except my main issue ?



      Thanks for your help.










      share|improve this question














      I have been able to run wordpress with mysql and phpmyadmin all together with Docker.



      The problem is that I am using gulp with my themes, plugins and so need to implement the browsersync between my host files and my docker container.



      I have been looking online and found out only one example really close to my case: Browsersync within a Docker container.



      So I tried to follow his docker-compose.yml file by adding a new docker container node with a personal Dockerfile.



      Here are my docker-compose and Dockerfile (node) files:



      docker-compose.yml:



      version: '3'

      services:
      wordpress:
      image: wordpress:latest
      build:
      dockerfile: Dockerfile
      context: ./
      container_name: wordpress
      links:
      - mysql
      environment:
      - WORDPRESS_DB_USER=user
      - WORDPRESS_DB_NAME=db_name
      - WORDPRESS_TABLE_PREFIX=prefix_
      - WORDPRESS_DB_PASSWORD=password
      - WORDPRESS_DB_HOST=mysql:3306
      restart: unless-stopped
      ports:
      - 80:80
      volumes:
      - file_data:/var/www/html/Project
      networks:
      - back
      mysql:
      image: mysql:latest
      container_name: mysql
      command: mysqld --default-authentication-plugin=mysql_native_password
      environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_DATABASE=db_name
      - MYSQL_HOST=localhost
      - MYSQL_PASSWORD=password
      restart: unless-stopped
      ports:
      - "3306:3306"
      volumes:
      - db_data:/var/lib/mysql
      - ./config/database/db.sql:/docker-entrypoint-initdb.d/db.sql
      networks:
      - back
      phpmyadmin:
      depends_on:
      - mysql
      image: phpmyadmin/phpmyadmin
      container_name: phpmyadmin
      restart: unless-stopped
      ports:
      - 8088:80
      environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: password
      networks:
      - back
      node:
      restart: unless-stopped
      image: node:latest
      container_name: nodejs
      depends_on:
      - wordpress
      volumes:
      - file_data:/usr/src/app
      build:
      dockerfile: Dockerfile
      context: ./Gulp
      ports:
      - 3000:3000
      - 3001:3001
      networks:
      back: {}
      volumes:
      db_data: {}
      file_data: {}


      Dockerfile:



      FROM node:latest

      # Create app directory
      WORKDIR /usr/src/app/Gulp

      # Install app dependencies
      COPY Gulp Project ../

      RUN npm rebuild && npm install && npm install gulp@next && npm install --global gulp-cli

      EXPOSE 8080
      CMD [ "gulp" ]


      But the mean problem is whatever my Dockerfile looks like, even empty with only FROM node:latest, when I do docker build of my Dockerfile, I get an exited container, but when I create a docker container with Kitematic app of node, I get it Up properly. What am I doing wrong here ? And does my configuration looks good except my main issue ?



      Thanks for your help.







      node.js wordpress gulp docker-compose dockerfile






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 21:34









      jardindedenjardindeden

      204




      204
























          1 Answer
          1






          active

          oldest

          votes


















          0














          On your node docker file you need to change the port from 8080



          EXPOSE 3000    
          EXPOSE 3001





          share|improve this answer


























          • Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

            – jardindeden
            Nov 14 '18 at 14:44











          • Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

            – Clayton Harbich
            Nov 14 '18 at 15:44











          • Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

            – jardindeden
            Nov 15 '18 at 10:06











          • @jardindeden Updated again. Did this help?

            – Clayton Harbich
            Nov 20 '18 at 17:05











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289846%2fdocker-run-wordpress-mysql-gulp-node%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          On your node docker file you need to change the port from 8080



          EXPOSE 3000    
          EXPOSE 3001





          share|improve this answer


























          • Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

            – jardindeden
            Nov 14 '18 at 14:44











          • Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

            – Clayton Harbich
            Nov 14 '18 at 15:44











          • Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

            – jardindeden
            Nov 15 '18 at 10:06











          • @jardindeden Updated again. Did this help?

            – Clayton Harbich
            Nov 20 '18 at 17:05
















          0














          On your node docker file you need to change the port from 8080



          EXPOSE 3000    
          EXPOSE 3001





          share|improve this answer


























          • Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

            – jardindeden
            Nov 14 '18 at 14:44











          • Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

            – Clayton Harbich
            Nov 14 '18 at 15:44











          • Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

            – jardindeden
            Nov 15 '18 at 10:06











          • @jardindeden Updated again. Did this help?

            – Clayton Harbich
            Nov 20 '18 at 17:05














          0












          0








          0







          On your node docker file you need to change the port from 8080



          EXPOSE 3000    
          EXPOSE 3001





          share|improve this answer















          On your node docker file you need to change the port from 8080



          EXPOSE 3000    
          EXPOSE 3001






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 29 '18 at 23:24

























          answered Nov 13 '18 at 22:04









          Clayton HarbichClayton Harbich

          272413




          272413













          • Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

            – jardindeden
            Nov 14 '18 at 14:44











          • Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

            – Clayton Harbich
            Nov 14 '18 at 15:44











          • Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

            – jardindeden
            Nov 15 '18 at 10:06











          • @jardindeden Updated again. Did this help?

            – Clayton Harbich
            Nov 20 '18 at 17:05



















          • Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

            – jardindeden
            Nov 14 '18 at 14:44











          • Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

            – Clayton Harbich
            Nov 14 '18 at 15:44











          • Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

            – jardindeden
            Nov 15 '18 at 10:06











          • @jardindeden Updated again. Did this help?

            – Clayton Harbich
            Nov 20 '18 at 17:05

















          Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

          – jardindeden
          Nov 14 '18 at 14:44





          Yes I am trying to build an image and then run it with docker-compose. But when I do docker-compose, all containers are up, except node. So I am trying to just run it alone first. I realised that even to do docker run command from the image node:latest is not even working for me.. What is wrong there ? the image or my docker run command ? docker run -d node

          – jardindeden
          Nov 14 '18 at 14:44













          Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

          – Clayton Harbich
          Nov 14 '18 at 15:44





          Sorry I didn't understand your question. What are you wanting the "gulp" command to do? Does that run your project?

          – Clayton Harbich
          Nov 14 '18 at 15:44













          Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

          – jardindeden
          Nov 15 '18 at 10:06





          Ok I will add my gulpfile to explain. But to resume, I am using gulp to update my php, js and css of my theme and plugin by watching them using gulp browsersync.

          – jardindeden
          Nov 15 '18 at 10:06













          @jardindeden Updated again. Did this help?

          – Clayton Harbich
          Nov 20 '18 at 17:05





          @jardindeden Updated again. Did this help?

          – Clayton Harbich
          Nov 20 '18 at 17:05


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289846%2fdocker-run-wordpress-mysql-gulp-node%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma