Docker

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

谁都会走 提交于 2021-02-11 08:10:44
问题 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:09:48
问题 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

Can't connect to a testcontainer Neo4J instance?

梦想与她 提交于 2021-02-11 08:09:20
问题 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

Can't connect to a testcontainer Neo4J instance?

对着背影说爱祢 提交于 2021-02-11 08:08:39
问题 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

How to pass flags to java process in Docker contatiner built by Cloud Native Buildpacks (CNB)

五迷三道 提交于 2021-02-11 07:23:56
问题 Normally when I create Docker image I do something like this: FROM openjdk:15-jdk-slim ARG version=undefined LABEL version=${version} WORKDIR / COPY build/libs/v2t-api-$version.jar /v2t-api.jar USER nobody VOLUME ["/tmp"] EXPOSE 8080 EXPOSE 8081 ENTRYPOINT ["sh", "-c", "exec java ${JAVA_OPTS} -jar v2t-api.jar"] So, when I start my container in for example kubernetes I can set JAVA_OPTS which defines how many memory is available for heap or how many CPUs are actually there. Packaging OCI

ElasticSearch-head 操作时,报 406错误码

十年热恋 提交于 2021-02-11 07:06:53
查询时报错{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406} 解决方法: 1、进入head安装目录;docker exec -it 名称 bash 2、打开文件夹_site,cd _site/ 3、编辑vendor.js 共有两处   ①. 6886行 contentType: "application/x-www-form-urlencoded     改成     contentType: "application/json;charset=UTF-8"   ②. 7574行 var inspectData = s.contentType === "application/x-www-form-urlencoded" &&     改成    var inspectData = s.contentType === "application/json;charset=UTF-8" && 4、退出容器exit 然后重启 5、重新查询,可以查出数据 来源: oschina 链接: https://my.oschina.net/u/4258573/blog/3327635

Springboot 打包 docker镜像

為{幸葍}努か 提交于 2021-02-11 06:47:07
1.配置 Docker Remote API vi /usr/lib/systemd/system/docker.service 直接在 ExecStart 启动参数的 /usr/bin/dockerd 后面添加以开启 TCP 连接:-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock 重新载入 systemd systemctl daemon-reload 重启docker 本地测试:curl http://localhost:2375/info 远程测试 ip:2375/info 返回json数据 远程不好使 可能是防火墙问题 2.最好在Linux服务 现准备好父镜像 3.Springboot添加docker-maven-plugin 插件 <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

How to omit if variable is empty in Ansibe?

喜欢而已 提交于 2021-02-11 06:22:23
问题 I'm going through ansible example for Docker. And I need to publish a port just like in the example but with an if statement if port else omit . Like this: docker_container: name: myapplication ... ports: - "{{ if port else omit }}" # the {{ port }} variable is set from the default task. ... But each time I run this, the Docker daemon tells me: template error while templating string: expected token 'end of print statement', got 'port'. String: {{ if port else omit }}" How do I omit setting

How to omit if variable is empty in Ansibe?

删除回忆录丶 提交于 2021-02-11 06:21:52
问题 I'm going through ansible example for Docker. And I need to publish a port just like in the example but with an if statement if port else omit . Like this: docker_container: name: myapplication ... ports: - "{{ if port else omit }}" # the {{ port }} variable is set from the default task. ... But each time I run this, the Docker daemon tells me: template error while templating string: expected token 'end of print statement', got 'port'. String: {{ if port else omit }}" How do I omit setting

How do you change default detach key sequence in docker?

坚强是说给别人听的谎言 提交于 2021-02-11 05:13:00
问题 Docker container's detach key sequence by default is control+q or control+p. There is an option to set key sequence when starting a container using --detach-keys "<sequence>" but I am looking for a permanent change. Is there a way to change this key sequence to something else? 回答1: Per user, you can configure this in the $HOME/.docker/config.json file. Add a json entry similar to: { "auths": { ... }, "detachKeys": "ctrl-x,x" } The "auths" line is just giving a relative location in the json,