首页 \ 问答 \ unity3d怎么直接开发android游戏

unity3d怎么直接开发android游戏

更新时间:2023-12-16 20:12

最满意答案

1. 安装 Docker
在开始前,我们首先得确保在Linux主机中已经安装了Docker。这里,我运行的是CentOS 7 主机,我们将运行yum管理器和下面的命令来安装Docker。
# yum install docker

# systemctl restart docker.service

2. 创建 Dockerfile
现在,Docker守护进程已经在运行中了,我们现在准备创建自己的Firefox Docker容器。我们要创建一个Dockerfile,在其中我们要输入需要的配置来创建一个可以工作的Firefox容器。为了运行 Docker 镜像我们需要使用最新版本的CentOS。要创建 Docker 镜像,我们需要用文本编辑器创建一个名为Dockerfile的文件。
# nano Dockerfile

接着,在Dockerfile中添加下面的行并保存。
#!/bin/bashFROM centos:7RUN yum install -y firefox# 用你自己的 uid /gid 替换下面的0RUN export uid=0 gid=0RUN mkdir -p /home/developerRUN echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwdRUN echo "developer:x:${uid}:" >> /etc/groupRUN echo "developer ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoersRUN chmod 0440 /etc/sudoersRUN chown ${uid}:${gid} -R /home/developerUSER developerENV HOME /home/developerCMD /usr/bin/firefox

注意:在第四行的配置中,用你自己的用户和组id来替换0。 我们可以用下面的命令在shell或者终端中得到uid和gid。

其他回答

1. 安装 docker
在开始前,我们首先得确保在linux主机中已经安装了docker。这里,我运行的是centos 7 主机,我们将运行yum管理器和下面的命令来安装docker。
# yum install docker

# systemctl restart docker.service

2. 创建 dockerfile
现在,docker守护进程已经在运行中了,我们现在准备创建自己的firefox docker容器。我们要创建一个dockerfile,在其中我们要输入需要的配置来创建一个可以工作的firefox容器。为了运行 docker 镜像我们需要使用最新版本的centos。要创建 docker 镜像,我们需要用文本编辑器创建一个名为dockerfile的文件。
# nano dockerfile

接着,在dockerfile中添加下面的行并保存。
#!/bin/bashfrom centos:7run yum install -y firefox# 用你自己的 uid /gid 替换下面的0run export uid=0 gid=0run mkdir -p /home/developerrun echo "developer:x:${uid}:${gid}:developer,,,:/home/developer:/bin/bash" >> /etc/passwdrun echo "developer:x:${uid}:" >> /etc/grouprun echo "developer all=(all) nopasswd: all" >> /etc/sudoersrun chmod 0440 /etc/sudoersrun chown ${uid}:${gid} -r /home/developeruser developerenv home /home/developercmd /usr/bin/firefox

注意:在第四行的配置中,用你自己的用户和组id来替换0。 我们可以用下面的命令在shell或者终端中得到uid和gid。
#  id $user

3. 构造docker容器
下面我们就要根据上面的dockerfile构建一个容器。它会安装firefox浏览器和它需要的包。它接着会设置用户权限并让它可以工作。这里镜像名是firefox,你可以根据你的需要命名。
# docker build --rm -t firefox .

4. 运行docker容器
现在,如果一切顺利,我们现在可以在运行在centos 7镜像中的docker容器里面运行我们的gui程序也就是firefox浏览器了。
# docker run -ti --rm -e display=$display -v /tmp/.x11-unix:/tmp/.x11-unix firefox

总结
在docker容器中运行gui程序是一次很棒的体验,它对你的主机文件系统没有任何的伤害。它完全依赖你的docker容器。本教程中,我尝试了centos 7 docker中的firefox。我们可以用这个技术尝试更多的gui程序。

相关问答

更多
  • 我们可以轻易地在Docker容器中运行大多数GUI程序且不出错。Docker是一个开源项目,提供了一个打包、分发和运行任意程序的轻量级容器 的开放平台。它没有语言支持、框架或者打包系统的限制,并可以运行在任何地方、任何时候,从小型的家用电脑到高端的服务器都可以运行。这让人们可以打包不 同的包用于部署和扩展网络应用,数据库和后端服务而不必依赖于特定的栈或者提供商。 下面是我们该如何在Docker容器中运行GUI程序的简单步骤。本教程中,我们会用Firefox作为例子。 1. 安装 Docker 在开始前,我们 ...
  • 1. 安装 Docker 在开始前,我们首先得确保在Linux主机中已经安装了Docker。这里,我运行的是CentOS 7 主机,我们将运行yum管理器和下面的命令来安装Docker。 # yum install docker # systemctl restart docker.service 2. 创建 Dockerfile 现在,Docker守护进程已经在运行中了,我们现在准备创建自己的Firefox Docker容器。我们要创建一个Dockerfile,在其中我们要输入需要的配置来创建一个可以工作 ...
  • 如果在docker run后面追加-d=true或者-d,那么容器将会运行在后台模式。此时所有I/O数据只能通过网络资源或者共享卷组来进行交互。因为容器不再监听你执行docker run的这个终端命令行窗口。但你可以通过执行docker attach来重新附着到该容器的回话中。需要注意的是,容器运行在后台模式下,是不能使用--rm选项的。
  • 1. 安装 Docker 在开始前,我们首先得确保在Linux主机中已经安装了Docker。这里,我运行的是CentOS 7 主机,我们将运行yum管理器和下面的命令来安装Docker。 # yum install docker # systemctl restart docker.service 2. 创建 Dockerfile 现在,Docker守护进程已经在运行中了,我们现在准备创建自己的Firefox Docker容器。我们要创建一个Dockerfile,在其中我们要输入需要的配置来创建一个可以工作 ...
  • 你可以直接安装vncserver和firefox :) 我在这里推送了一个图像vnc / firefox: docker pull creack/firefox-vnc 该图像已经使用这个Dockerfile: # Firefox over VNC # # VERSION 0.1 # DOCKER-VERSION 0.2 from ubuntu:12.04 # make sure the package repository is up to date ru ...
  • 使用VirtualBox的控制台时一切正常。 它只在Windows的控制台中失败(使用Docker Quickstart终端)。 我认为根本问题在于行尾代码字符( \n , \r或\r\n )。 When using VirtualBox's console everything works. It only fails in Windows's console (using the Docker Quickstart Terminal). I think the underlying problem is ...
  • 1.-您启动的第一个容器(您启动另一个容器的容器)必须使用--privileged=true标志运行。 2.-我认为没有。 3.-使用特权标志,您不需要将docker套接字作为卷装入。 选中此项目即可查看所有这些示例。 1.- The first container you start (the one you launch other one inside) must be run with the --privileged=true flag. 2.- I think there is not. 3.- ...
  • 试试app.run(host='0.0.0.0') 。 默认情况下,Flask服务器只能从本地主机访问。 在你的情况下,容器是本地主机,你的请求来自容器外部。 host='0.0.0.0'参数使服务器可以从外部IP访问。 它在Flask文档中有详细描述。 Try app.run(host='0.0.0.0'). By default, Flask server is only accessible from the localhost. In your case, the container is the ...
  • 目前无法限制对特权容器的访问。 这就是为什么,例如,Fedora已经放弃了docker组(因为授予对docker的访问权限就像授予无密码sudo访问权限一样)。 如果你想提供“docker-as-a-service”,你可能想要像Kubernetes一样放在它前面,它只提供对Docker API的间接访问,并且可以配置为允许或拒绝使用特权容器。 There is currently no way to restrict access to privileged containers. This is why ...
  • 请记住, mysql映像仅在第一次启动时(初始化其数据目录时)设置您使用该环境变量提供的密码。 因此, 如果您认为这是您的情况 ,请清空您的mysql数据卷(丢失数据)并再次启动它, 或手动设置root密码。 Bear in mind that the mysql image only set the password that you provide with that environment variable when it starts for the first time (when it init ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。