I have a very basic Dockerfile that installs Vue CLI and exposes port 8080:
FROM node
RUN yarn global add @vue/cli
EXPOSE 8080
I have a docker-compose.yml that connects the host port to the exposed one on the container:
version: '3'
services:
vue:
build:
context: .
dockerfile: ./Dockerfile
volumes:
- .:/home/node
working_dir: '/home/node'
ports:
- '8080:8080'
I run up a container with docker-compose run vue bash then create a Vue project with vue create foo.
Inside the project folder I've added a vue.config.js:
module.exports = {
devServer: {
host: '0.0.0.0',
port: 8080
}
}
When I run the development server with yarn serve I see:
App running at:
- Local: http://localhost:8080/
It seems you are running Vue CLI inside a container.
Access the dev server via http://localhost:<your container's external mapped port>/
While it's showing that it's hosted locally on localhost and not 0.0.0.0 this appears to be a known display bug.
However, I am unable to reach Vue via http://localhost:8080 from the host machine.
I've looked at multiple tutorials for setting this up and am unable to work out why I cannot reach the Vue dev server.