Giter VIP home page Giter VIP logo

magic_mirror_mac_docker's Introduction

Setting up MagicMirror in Mac through Docker

新建文件夹叫做 magic_mirror,路径为 ~/docker/magic_mirror

进入 magic_mirror 文件夹,新建文件夹 configmodules 来存放 config.js 文件 和 自己建的 module

新建文件 run.sh

#!/bin/bash

docker run  -d \
	--publish 8080:8080 \
	--restart always \
	--volume ~/docker/magic_mirror/config:/opt/magic_mirror/config \
	--volume ~/docker/magic_mirror/modules:/opt/magic_mirror/modules \
	--volume /etc/localtime:/etc/localtime:ro \
	--name magic_mirror \
    bastilimbach/docker-magicmirror

注意 : --publish 8080:8080 \ 表示通过 8080 端口去访问 docker container 的 8080 端口。

--volume ~/docker/magic_mirror/config:/opt/magic_mirror/config \ 使用的是当前的 config 文件夹。意思是同步挂载文件夹内容至 Docker 中 magic_mirror/config

进入 config 文件夹中新建 config.js 文件,并填入

var config = {
	address: "0.0.0.0",
	port: 8080,
  ipWhitelist: [],
	language: "en",
	timeFormat: 24,
	units: "metric",

	modules: [
		{
			module: "alert",
		},
		{
			module: "updatenotification",
			position: "top_bar"
		},
		{
			module: "clock",
			position: "top_left"
		},
	]

};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}
 0

其中 ipWhitelist: [], 用来白名单主机的 ip 地址,进行访问,不填表示允许所有 ip。

查看 Docker IP 地址命令 docker inspect magic_mirror --format='{{.NetworkSettings.IPAddress}}'

【以下内容暂不需要】

设置 docker 的主机地址 “0.0.0.0” 为 “127.0.0.1” 进行 localhost:8080 的访问:
从 Docker 菜单栏,进入 Docker > Preferences > Docker Engine ,添加:
 "ip" : "127.0.0.1",
添加后如下:
    {
      "ip" : "127.0.0.1",
      "debug" : true,
      "experimental" : false
    }
点击 Apply & Restart,重启 Docker,让配置生效。

回到 magic_mirror 目录,运行 ./run.sh,来运行 magic_mirror contianer。

打开浏览器,访问 http://localhost:8080 这时候就可以访问到 Docker 中运行的 MagicMirror 了

升级 MagicMirror

访问 localhost:8080 ,这时候可能出现 MagicMirror 需要升级。

进入 docker 的 bash 中,host terminal 中运行。

docker exec -it magic_mirror /bin/bash

运行 git pull && npm install

可能要事先运行 git reset --hard

运行完毕后打开 lazydocker,重启 container 即可。刷新浏览器,已经升级到最新的版本了。

参考

magic_mirror_mac_docker's People

Contributors

sayidhe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.