0
VM을 실행할 때마다 Vagrant에서 사용할 수있는 별칭을 만들려고합니다. 웹에서 여러 소스를 찾았지만 제대로 작동하지 않습니다. 내 동기화 된 폴더에 .bash_profile을 만들려고했으나 작동하지 않았습니다. 명령 별칭 = "command"를 실행하면 현재 세션에서만 작동하는 것으로 나타났습니다. 누구든지이 작업을 수행하는 방법을 알고 있습니까? 나는 macOS를 사용하고있다. 당신의 도움을 주셔서 감사합니다!Vagrant에서 별칭을 사용하는 방법
# -*- mode: ruby -*-
# vi: set ft=ruby :
unless Vagrant.has_plugin?("vagrant-vbguest")
warn "\nWARNING: The vagrant-vbguest plugin should be installed or your shared folders might not mount properly!"
warn "You can do this by running the command 'vagrant plugin install vagrant-vbguest'.\n\n"
end
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "pype_vm"
config.vm.box_url = "https://.../pype_vm.json"
config.vm.network "private_network", ip: ""
config.vm.boot_timeout = 600
config.vm.provider "virtualbox" do |v|
# This forces VirtualBox to use the host's DNS resolver instead of
# VirtualBox's
v.customize ["modifyvm", :id, "", "on"]
# This enables the PAE/NX option, which resolved at least one user's
# issues with the VM hanging on boot
v.customize ["modifyvm", :id, "--pae", "on"]
# The RHEL VM was created with 2GB of memory to facilitate provisioning,
# but this is causing issues with certain workstations. This reduces
# the amount of memory allocated to the VM but should not impact development
# performance. The number is in MB and can be increased if desired.
v.memory = 1024
end
# Share an additional folder to the guest VM.
config.vm.synced_folder File.dirname(__FILE__), "/pype"
end
별칭은 대화 형 기능으로 비대화 형 쉘과 함께 사용하지 않습니다. 유스 케이스의 세부 사항은 무엇입니까? –
(대화 형 셸을 컨테이너 내부에서 실행하는 경우'.bash_profile'이 컨테이너 내부에 * 있는지 확인해야합니다.). –
... btw, 대신 내 보낸 함수를 사용하는 것이 좋습니다; 그런 식으로 하위 프로세스로 실행되는 셸로 전달됩니다. 약간의주의를 기울여 환경 변수로 Vagrantfile에 정의를 넣을 수도 있습니다. –