Running docker run in Chef











up vote
1
down vote

favorite












I am looking to make Chef manage running docker containers. However I am not sure how to move forward. This the docker run command which I use today and want to make it Chef friendly and move it into my recipies:



docker run --name=nginx--restart=unless-stopped -p 443:443 -p 80:80 --privileged=true -v /etc/php:/conf/stack -v /var/www/html -d repository.com/nginx:v1.5.3


Any tips or ideas?










share|improve this question


















  • 1




    I am looking to make Chef manage running docker containers. - why?
    – johnharris85
    Nov 12 at 19:29










  • @johnharris85 - Because I want Chef to handle my containers.
    – user3270211
    Nov 15 at 16:44















up vote
1
down vote

favorite












I am looking to make Chef manage running docker containers. However I am not sure how to move forward. This the docker run command which I use today and want to make it Chef friendly and move it into my recipies:



docker run --name=nginx--restart=unless-stopped -p 443:443 -p 80:80 --privileged=true -v /etc/php:/conf/stack -v /var/www/html -d repository.com/nginx:v1.5.3


Any tips or ideas?










share|improve this question


















  • 1




    I am looking to make Chef manage running docker containers. - why?
    – johnharris85
    Nov 12 at 19:29










  • @johnharris85 - Because I want Chef to handle my containers.
    – user3270211
    Nov 15 at 16:44













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am looking to make Chef manage running docker containers. However I am not sure how to move forward. This the docker run command which I use today and want to make it Chef friendly and move it into my recipies:



docker run --name=nginx--restart=unless-stopped -p 443:443 -p 80:80 --privileged=true -v /etc/php:/conf/stack -v /var/www/html -d repository.com/nginx:v1.5.3


Any tips or ideas?










share|improve this question













I am looking to make Chef manage running docker containers. However I am not sure how to move forward. This the docker run command which I use today and want to make it Chef friendly and move it into my recipies:



docker run --name=nginx--restart=unless-stopped -p 443:443 -p 80:80 --privileged=true -v /etc/php:/conf/stack -v /var/www/html -d repository.com/nginx:v1.5.3


Any tips or ideas?







linux docker chef redhat chef-recipe






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 at 17:49









user3270211

43931130




43931130








  • 1




    I am looking to make Chef manage running docker containers. - why?
    – johnharris85
    Nov 12 at 19:29










  • @johnharris85 - Because I want Chef to handle my containers.
    – user3270211
    Nov 15 at 16:44














  • 1




    I am looking to make Chef manage running docker containers. - why?
    – johnharris85
    Nov 12 at 19:29










  • @johnharris85 - Because I want Chef to handle my containers.
    – user3270211
    Nov 15 at 16:44








1




1




I am looking to make Chef manage running docker containers. - why?
– johnharris85
Nov 12 at 19:29




I am looking to make Chef manage running docker containers. - why?
– johnharris85
Nov 12 at 19:29












@johnharris85 - Because I want Chef to handle my containers.
– user3270211
Nov 15 at 16:44




@johnharris85 - Because I want Chef to handle my containers.
– user3270211
Nov 15 at 16:44












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










You can use the "official" Docker cookbook from Chef's Supermarket - https://supermarket.chef.io/cookbooks/docker



Then as an example you can do:



# Pull latest image
docker_image 'nginx' do
tag 'latest'
action :pull
notifies :redeploy, 'docker_container[my_nginx]'
end

# Run container mapping containers port 80 to the host's port 80
docker_container 'my_nginx' do
repo 'nginx'
tag 'latest'
port '80:80'
host_name 'www'
domain_name 'computers.biz'
env 'FOO=bar'
volumes [ '/some/local/files/:/etc/nginx/conf.d' ]
end





share|improve this answer





















  • It seems that the cookbook does not support the Redhat platform.
    – user3270211
    Dec 1 at 14:58











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267508%2frunning-docker-run-in-chef%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










You can use the "official" Docker cookbook from Chef's Supermarket - https://supermarket.chef.io/cookbooks/docker



Then as an example you can do:



# Pull latest image
docker_image 'nginx' do
tag 'latest'
action :pull
notifies :redeploy, 'docker_container[my_nginx]'
end

# Run container mapping containers port 80 to the host's port 80
docker_container 'my_nginx' do
repo 'nginx'
tag 'latest'
port '80:80'
host_name 'www'
domain_name 'computers.biz'
env 'FOO=bar'
volumes [ '/some/local/files/:/etc/nginx/conf.d' ]
end





share|improve this answer





















  • It seems that the cookbook does not support the Redhat platform.
    – user3270211
    Dec 1 at 14:58















up vote
1
down vote



accepted










You can use the "official" Docker cookbook from Chef's Supermarket - https://supermarket.chef.io/cookbooks/docker



Then as an example you can do:



# Pull latest image
docker_image 'nginx' do
tag 'latest'
action :pull
notifies :redeploy, 'docker_container[my_nginx]'
end

# Run container mapping containers port 80 to the host's port 80
docker_container 'my_nginx' do
repo 'nginx'
tag 'latest'
port '80:80'
host_name 'www'
domain_name 'computers.biz'
env 'FOO=bar'
volumes [ '/some/local/files/:/etc/nginx/conf.d' ]
end





share|improve this answer





















  • It seems that the cookbook does not support the Redhat platform.
    – user3270211
    Dec 1 at 14:58













up vote
1
down vote



accepted







up vote
1
down vote



accepted






You can use the "official" Docker cookbook from Chef's Supermarket - https://supermarket.chef.io/cookbooks/docker



Then as an example you can do:



# Pull latest image
docker_image 'nginx' do
tag 'latest'
action :pull
notifies :redeploy, 'docker_container[my_nginx]'
end

# Run container mapping containers port 80 to the host's port 80
docker_container 'my_nginx' do
repo 'nginx'
tag 'latest'
port '80:80'
host_name 'www'
domain_name 'computers.biz'
env 'FOO=bar'
volumes [ '/some/local/files/:/etc/nginx/conf.d' ]
end





share|improve this answer












You can use the "official" Docker cookbook from Chef's Supermarket - https://supermarket.chef.io/cookbooks/docker



Then as an example you can do:



# Pull latest image
docker_image 'nginx' do
tag 'latest'
action :pull
notifies :redeploy, 'docker_container[my_nginx]'
end

# Run container mapping containers port 80 to the host's port 80
docker_container 'my_nginx' do
repo 'nginx'
tag 'latest'
port '80:80'
host_name 'www'
domain_name 'computers.biz'
env 'FOO=bar'
volumes [ '/some/local/files/:/etc/nginx/conf.d' ]
end






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 27 at 12:19









Belogix

7,2301829




7,2301829












  • It seems that the cookbook does not support the Redhat platform.
    – user3270211
    Dec 1 at 14:58


















  • It seems that the cookbook does not support the Redhat platform.
    – user3270211
    Dec 1 at 14:58
















It seems that the cookbook does not support the Redhat platform.
– user3270211
Dec 1 at 14:58




It seems that the cookbook does not support the Redhat platform.
– user3270211
Dec 1 at 14:58


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267508%2frunning-docker-run-in-chef%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)