Docker

How does “volumes” override the docker image's original files with docker-compose?

笑着哭i 提交于 2021-02-11 12:09:13
问题 Let's use this docker-compose.yml : version: '2' services: db: image: mysql:5.7 volumes: - ./mysql:/var/lib/mysql # <- important restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest volumes: - ./wp:/var/www/html # <- important ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD:

How to link two containers using docker-compose

筅森魡賤 提交于 2021-02-11 09:57:14
问题 At the moment I have two containers which I build from an image and then link the two: For example: #mysql docker build -t my/mysql docker-mysql docker run -p 3306:3306 --name mysql -d my/mysql:latest #webapp docker build -t my/tomcat:7.0 tomcat/7.0 docker run -d --link mysql --name tomcat7 my/tomcat:7.0 Since I'm linking the webapp container with mysql container, the webapp container gets a MYSQL_PORT_3306_TCP_ADDR environment variable created. I use this environment variable to then connect

How to link two containers using docker-compose

天涯浪子 提交于 2021-02-11 09:56:50
问题 At the moment I have two containers which I build from an image and then link the two: For example: #mysql docker build -t my/mysql docker-mysql docker run -p 3306:3306 --name mysql -d my/mysql:latest #webapp docker build -t my/tomcat:7.0 tomcat/7.0 docker run -d --link mysql --name tomcat7 my/tomcat:7.0 Since I'm linking the webapp container with mysql container, the webapp container gets a MYSQL_PORT_3306_TCP_ADDR environment variable created. I use this environment variable to then connect

How to link two containers using docker-compose

浪尽此生 提交于 2021-02-11 09:56:41
问题 At the moment I have two containers which I build from an image and then link the two: For example: #mysql docker build -t my/mysql docker-mysql docker run -p 3306:3306 --name mysql -d my/mysql:latest #webapp docker build -t my/tomcat:7.0 tomcat/7.0 docker run -d --link mysql --name tomcat7 my/tomcat:7.0 Since I'm linking the webapp container with mysql container, the webapp container gets a MYSQL_PORT_3306_TCP_ADDR environment variable created. I use this environment variable to then connect

Localhost redirecting to localhost/tutorial

别来无恙 提交于 2021-02-11 09:08:33
问题 Yo! I am having an issue with my localhost after installing Docker Desktop. It automatically redirects to localhost/tutorial. I believe that is for the "beginner" container that comes with docker desktop, however even after removing it, and having other containers running, or even if docker is completely turned off, it still automatically redirects, which leads me to believe the issue is something with Windows. I've checked my hosts file on windows and can't find anything wrong, but in case

Localhost redirecting to localhost/tutorial

拥有回忆 提交于 2021-02-11 09:01:40
问题 Yo! I am having an issue with my localhost after installing Docker Desktop. It automatically redirects to localhost/tutorial. I believe that is for the "beginner" container that comes with docker desktop, however even after removing it, and having other containers running, or even if docker is completely turned off, it still automatically redirects, which leads me to believe the issue is something with Windows. I've checked my hosts file on windows and can't find anything wrong, but in case

Docker execute ant script after tomcat starts?

陌路散爱 提交于 2021-02-11 08:56:10
问题 Dockerfile works correctly for tomcat. After tomcat starts, I have to trigger ant scripts. catalina.sh is started from a separate run.sh file. So, Dockerfile has CMD ["/tmp/run.sh"] The run.sh file has below lines: catalina.sh run antscript Tomcat starts but ant scripts are not called. I also tried other possibilities like: catalina.sh run && antscripts tomcat starts but antscripts are not triggered Is there a way that I can call the ant scripts automatically after tomcat starts? I dont want

kubesphere集群搭建(多节点)

独自空忆成欢 提交于 2021-02-11 08:31:24
kubesphere官网: https://kubesphere.io/docs/advanced-v2.0/zh-CN/introduction/intro/ 一、准备环境 1、准备服务器 master1 :192.168.37.11 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) + 200G(mnt) master2 :192.168.37.12 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) master3 :192.168.37.13 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) node1: 192.168.37.14 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) node2: 192.168.37.15 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) node3: 192.168.37.16 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) node4: 192.168.37.17 centos7.5 + 8cpu + 16G(内存) + 20G(/) +

How to execute something as a root user (initially) for an otherwise non-root user container?

可紊 提交于 2021-02-11 08:14:42
问题 I want to sync the host machine's user/group with the docker machine to enable (developers) to edit the files inside or outside the container. There are some ideas like this: Handling Permissions with Docker Volumes which creates a new user. I would like to try a similar approach, but instead of creating a new user, I would like to modify the existing user using usermod : usermod -d /${tmp} docker # avoid `usermod` from modifying permissions automatically. usermod -u "${HOST_USER_ID}" docker

Can't connect to a testcontainer Neo4J instance?

北城以北 提交于 2021-02-11 08:11:11
问题 this is my test class: @Testcontainers @ReactiveDataNeo4jTest internal class RepositoryIT { @Container private val container = KNeo4jContainer.instance @Test fun `should answer with One`() { val boltUrl = container.getBoltUrl() GraphDatabase.driver( boltUrl, AuthTokens.basic("neo4j", "123456")) .use { driver -> driver.session().use { session -> val res = session.run("OPTIONAL MATCH(n) RETURN 1 AS value") val one = res.single().get("value").asInt() assertThat(one).isEqualTo(2) } } } } object