Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit691c31f

Browse files
shared host param
1 parentfc41b49 commit691c31f

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

‎_docs/codefresh-yaml/service-containers.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,58 @@ Notice that in that case the sequence of events is the following
480480
1. The`setup` block will run and preload data or setup any custom commands you have placed in the property
481481
1. The actual pipeline step will now run with the service container attached in the same network.
482482

483+
##Accessing Containers via localhost
484+
485+
Ideally, your application should be able to access other services by other DNS names that are fully configurable (this is a very good practice for[integration tests]({{site.baseurl}}/docs/docs/testing/integration-tests/) as well).
486+
487+
Sometimes, however, and especially in legacy applications, your application might be hardcoded to look at other services at “localhost”
488+
489+
In that case, you can use the attribute`shared_host_network: true` on the services definition. Now all linked containers can access each other's services via localhost. Here is an example:
490+
491+
version: "1.0"
492+
steps:
493+
my_first_step:
494+
image: goodsmileduck/redis-cli
495+
title: Storing Redis data
496+
commands:
497+
- apk add curl
498+
- redis-cli -u redis://localhost:6379 -n 0 LPUSH mylist "hello world"
499+
- curlhttp://localhost:80
500+
- echo finished
501+
services:
502+
shared_host_network: true
503+
composition:
504+
my_redis_service:
505+
image: 'redis:latest'
506+
507+
my_nginx:
508+
image: 'nginx'
509+
510+
You can also do the same thing with top level services:
511+
512+
version: "1.0"
513+
services:
514+
name: my_database
515+
shared_host_network: true
516+
composition:
517+
my_redis_service:
518+
image: 'redis:latest'
519+
my_nginx:
520+
image: 'nginx'
521+
steps:
522+
my_first_step:
523+
image: goodsmileduck/redis-cli
524+
title: Storing Redis data
525+
commands:
526+
- apk add curl
527+
- redis-cli -u redis://localhost:6379 -n 0 LPUSH mylist "hello world"
528+
- curlhttp://localhost:80
529+
- echo finished
530+
services:
531+
- my_database
532+
533+
Note: we do recommend you only use this option as a last resort. You should not hardcode “localhost” as a requirement in your services.
534+
483535
##Limitations
484536

485537
Service containers are not compatible with[custom pipeline steps]({{site.baseurl}}/docs/codefresh-yaml/steps/#limitations-of-custom-plugins).

‎_docs/whats-new/whats-new.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ toc: true
1515

1616
###March 2021
1717

18+
- Accessing Containers via localhost -[documentation]({{site.baseurl}}/docs/codefresh-yaml/service-containers/)
19+
20+
1821
- The[Modified Files filter]({{site.baseurl}}/docs/configure-ci-cd-pipeline/triggers/git-triggers/#monorepo-support-modified-files) will now work on triggers triggered by Pull Request events. Notice: this might cause unexpected behavior if you have a trigger that is triggered by both Pull Request and Commit events with a Modified Files filter set. Previously the Modified Files filter would be ignored for Pull Request events. If you need different filters for Pull Requests and Commit events, we recommend you separate the trigger.
1922
- Codefresh Runner on Rancher RKE 2.X -[documentation]({{site.baseurl}}/docs/administration/codefresh-runner/#installing-on-rancher-rke-2x)
2023

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp